Project deleted and recreated resulting in 500 error
Summary
Project was deleted and recreated some time later with the same name. Navigating to the project after creation resulted in the following 500 error:
Gitlab::Git::Repository::NoRepository (no repository for such path):
app/models/repository.rb:473:in `method_missing'
app/models/repository.rb:686:in `local_branches'
app/models/repository.rb:255:in `block in branch_count'
lib/repository_cache.rb:19:in `fetch'
app/models/repository.rb:255:in `branch_count'
app/models/repository.rb:85:in `block in has_visible_content?'
lib/repository_cache.rb:19:in `fetch'
app/models/repository.rb:84:in `has_visible_content?'
app/models/project.rb:843:in `empty_repo?'
app/controllers/projects_controller.rb:258:in `repo_exists?'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/middleware/readonly_geo.rb:29:in `call'
Clearing the cache fixed the problem
Additional Detail
Relevant log entries from Production.log file
Started DELETE "/gitlab/[FILTERED]/[FILTERED]" for 127.0.0.1 at 2016-07-11 12:16:59 -0700
Processing by ProjectsController#destroy as HTML
Parameters: {"authenticity_token"=>"[FILTERED]", "namespace_id"=>"[FILTERED]", "id"=>"[FILTERED]"}
Redirected to [FILTERED]
Completed 302 Found in 133ms (ActiveRecord: 12.4ms)
Started GET "/gitlab/projects/new" for 127.0.0.1 at 2016-07-11 12:17:06 -0700
Processing by ProjectsController#new as HTML
Completed 200 OK in 241ms (Views: 144.4ms | ActiveRecord: 13.7ms)
Started POST "/gitlab/projects" for 127.0.0.1 at 2016-07-11 12:17:23 -0700
Processing by ProjectsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "project"=>{"namespace_id"=>"9", "path"=>"[FILTERED]", "import_url"=>"[FILTERED]", "mirror"=>"1", "mirror_user_id"=>"12", "description"=>"", "visibility_level"=>"20"}}
Completed 200 OK in 427ms (Views: 201.1ms | ActiveRecord: 28.4ms)
Started POST "/gitlab/projects" for 127.0.0.1 at 2016-07-11 12:17:36 -0700
Processing by ProjectsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "project"=>{"namespace_id"=>"9", "path"=>"[FILTERED]", "import_url"=>"[FILTERED]", "mirror"=>"1", "mirror_user_id"=>"12", "description"=>"", "visibility_level"=>"20"}}
Completed 200 OK in 289ms (Views: 105.3ms | ActiveRecord: 25.9ms)
Started GET "/gitlab/projects/new" for 127.0.0.1 at 2016-07-11 12:46:19 -0700
Processing by ProjectsController#new as HTML
Completed 200 OK in 236ms (Views: 96.2ms | ActiveRecord: 11.4ms)
Started POST "/gitlab/projects" for 127.0.0.1 at 2016-07-11 12:46:39 -0700
Processing by ProjectsController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "project"=>{"namespace_id"=>"9", "path"=>"[FILTERED]", "import_url"=>"[FILTERED]", "mirror"=>"1", "mirror_user_id"=>"12", "description"=>"", "visibility_level"=>"20"}}
Redirected to [FILTERED]
Completed 302 Found in 1497ms (ActiveRecord: 88.8ms)
Started GET "/gitlab/[FILTERED]/[FILTERED]" for 127.0.0.1 at 2016-07-11 12:46:41 -0700
Processing by ProjectsController#show as HTML
Parameters: {"namespace_id"=>"[FILTERED]", "id"=>"[FILTERED]"}
Completed 500 Internal Server Error in 135ms (ActiveRecord: 8.7ms)
Gitlab::Git::Repository::NoRepository (no repository for such path):
app/models/repository.rb:473:in `method_missing'
app/models/repository.rb:686:in `local_branches'
app/models/repository.rb:255:in `block in branch_count'
lib/repository_cache.rb:19:in `fetch'
app/models/repository.rb:255:in `branch_count'
app/models/repository.rb:85:in `block in has_visible_content?'
lib/repository_cache.rb:19:in `fetch'
app/models/repository.rb:84:in `has_visible_content?'
app/models/project.rb:843:in `empty_repo?'
app/controllers/projects_controller.rb:258:in `repo_exists?'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/middleware/readonly_geo.rb:29:in `call'
Started GET "/gitlab/[FILTERED]/[FILTERED]" for 127.0.0.1 at 2016-07-11 12:46:47 -0700
Processing by ProjectsController#show as HTML
Parameters: {"namespace_id"=>"[FILTERED]", "id"=>"[FILTERED]"}
Completed 500 Internal Server Error in 137ms (ActiveRecord: 9.0ms)
Gitlab::Git::Repository::NoRepository (no repository for such path):
app/models/repository.rb:473:in `method_missing'
app/models/repository.rb:686:in `local_branches'
app/models/repository.rb:255:in `block in branch_count'
lib/repository_cache.rb:19:in `fetch'
app/models/repository.rb:255:in `branch_count'
app/models/repository.rb:85:in `block in has_visible_content?'
lib/repository_cache.rb:19:in `fetch'
app/models/repository.rb:84:in `has_visible_content?'
app/models/project.rb:843:in `empty_repo?'
app/controllers/projects_controller.rb:258:in `repo_exists?'
lib/gitlab/middleware/go.rb:16:in `call'
lib/gitlab/middleware/readonly_geo.rb:29:in `call'