Skip to content

Cannot delete project when the owner doesn't exist anymore #1249

altimore opened this Issue Aug 17, 2012 · 8 comments

8 participants


Hello guys,

Nice project, with pretty GUI, thanks for developing this.

To reproduce the error :

Install gitlab
create a project named "test"
create a new admin user
login as this user
delete the default user
try to delete the test project

error 500

tkrueger commented Sep 5, 2012

Happened to me, too. After I added a user to the project, I could delete it without problems.


still happens with newest version, basically projects without owner fails...

easiest way to reproduce:
1. create new user
2. create new project
3. edit project and set owner to user at 1. step
4. delete user

now when you'll try open: /admin/projects/{project}

ActionView::Template::Error (undefined method `name' for nil:NilClass):
    31:       %b
    32:         Owner:
    33:     %td
    34:       =
    35:   %tr
    36:     %td
    37:       %b
  app/views/admin/projects/show.html.haml:34:in `_app_views_admin_projects_show_html_haml__2446171807977602936_49930480'

and when trying delete:

NoMethodError (undefined method `name' for nil:NilClass):
  app/observers/system_hook_observer.rb:45:in `after_destroy'
  app/controllers/admin/projects_controller.rb:55:in `destroy'

in both cases result page is: 500 We're sorry, but something went wrong.

koenpunt commented Dec 3, 2012

#1906 did fix this

@riyad ping.

riyad commented Dec 4, 2012

@koenpunt Thanks. :smile:

@riyad riyad closed this Dec 4, 2012

Issue is still present in GitLab 5.0. Error 500 is thrown when trying to delete the Test project created by default admin, after admin user is deleted.

hoest commented Apr 11, 2013

Even when I'm the owner of a project, I still cannot destroy/delete the project.

Started DELETE "/admin/projects/xxx" for at 2013-04-11 13:48:07 +0200
Processing by Admin::ProjectsController#destroy as HTML
Parameters: {"authenticity_token"=>"xxx=", "id"=>"xxx"}
Completed 500 Internal Server Error in 68ms
Redis::CommandError (ERR unknown command 'exec'):
app/observers/project_observer.rb:16:in `after_destroy'
app/controllers/admin/projects_controller.rb:45:in `destroy'

Got this problem too. I fixed it with:

diff --git a/app/services/system_hooks_service.rb b/app/services/system_hooks_service.rb
index 132bb14..712285c 100644
--- a/app/services/system_hooks_service.rb
+++ b/app/services/system_hooks_service.rb
@@ -27,8 +27,8 @@ class SystemHooksService
         path: model.path,
-        owner_name:,
-        owner_email:
+        owner_name: model.owner ? : 'unknwon',
+        owner_email: model.owner ? : 'unknown@invalid'
     when User
koenpunt commented May 2, 2013

There probably should be a test for this, so it won't happen again?

@randx randx pushed a commit that referenced this issue Mar 26, 2015
@stanhu stanhu Set Application controller default URL options to ensure all url_for …
…calls are consistent

Closes #1249
@randx randx added a commit that referenced this issue Mar 26, 2015
@randx randx Merge branch 'set-default-url-options' into 'master'
Set Application controller default URL options to ensure all url_for calls are consistent

### What does this MR do?

This MR sets the app controller's `default_url_options` so that all `url_for` calls are consistent.

### Are there points in the code the reviewer needs to double check?

Setting these options may simplify `url_for` calls that load the GitLab options already. I did not want to touch existing code yet. I'm also not sure if there are other options that need to be included.

### Why was this MR needed?

If you run GitLab behind a reverse proxy or in a Docker container, you don't want a user to be seeing the local IP and port on which GitLab is running (e.g. Right now there are places where this internal data is leaked (e.g. see the URL in Profile Settings -> Account -> Username; this uses `user_url`).

### What are the relevant issue numbers / [Feature requests](


See merge request !453
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.