ProjectsController#edit returns HTTP 500 for projects with empty repositories

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Summary

Visiting the project settings edit page (/<namespace>/<project>/edit) for a project with an empty repository (no commits, no default branch) results in an HTTP 500 error. This was caught by the preprod QA smoke pipeline on 2026-09-10 (https://ops.gitlab.net/gitlab-org/quality/preprod/-/jobs/26754902).

Error log

Job log

https://ops.gitlab.net/gitlab-org/quality/preprod/-/jobs/26754902

Failures:
  1) Plan Default issue templates uses default template when creating an issue
     Got 0 failures and 2 other errors:
     1.1) Failure/Error: Page::Project::Settings::Main.perform(&:expand_default_description_template_for_issues)
          
          Capybara::ElementNotFound:
            Unable to find css "[data-testid=\"issue-template-settings-content\"]"
          # ./qa/page/base.rb:448:in `within_element'
          # ./qa/support/page/logging.rb:156:in `within_element'
          # ./qa/page/settings/common.rb:11:in `expand_content'
          # ./qa/ee/page/project/settings/main.rb:22:in `expand_default_description_template_for_issues'
          # ./qa/scenario/actable.rb:16:in `perform'
          # ./qa/specs/features/ee/browser_ui/2_plan/issue/default_issue_template_spec.rb:18:in `block (3 levels) in <module:QA>'
          # /home/gitlab/spec/support/fast_quarantine.rb:22:in `block (2 levels) in <top (required)>'
          # ./qa/specs/runner.rb:125:in `run_rspec'
          # ./qa/specs/runner.rb:32:in `perform'
          # ./qa/scenario/template.rb:10:in `block in perform'
          # ./qa/scenario/template.rb:8:in `perform'
          # ./qa/scenario/template.rb:63:in `perform'
          # ./qa/scenario/template.rb:10:in `block in perform'
          # ./qa/scenario/template.rb:8:in `perform'
          # ./qa/scenario/bootable.rb:52:in `launch!'
     1.2) Failure/Error:
                      raise(PageError, <<~MSG)
                        Error Code: #{error_code}
            
                        #{report}
            
                        Path: #{page.current_path}#{request_id_string}
                      MSG
          
          QA::Support::PageErrorChecker::PageError:
            Error Code: 500
          
            There was 1 SEVERE level error:
          
            ["https://pre.gitlab.com/gitlab-e2e-sandbox-group-7/e2e-test-2026-09-10-09-43-16-3306a1dbdf60f014/default-issue-template-project-9581b3499e2f77a0/edit - Failed to load resource: the server responded with a status of 500 ()"]
          
            Path: /gitlab-e2e-sandbox-group-7/e2e-test-2026-09-10-09-43-16-3306a1dbdf60f014/default-issue-template-project-9581b3499e2f77a0/edit
          
            Correlation Id: 01M25B6JV9WMTAS6E97K3VMAPH
            Sentry Url: https://new-sentry.gitlab.net/organizations/gitlab/issues/?environment=pre&project=3&query=correlation_id%3A%2201M25B6JV9WMTAS6E97K3VMAPH%22
            Kibana - Discover Url: https://nonprod-log.gitlab.net/app/discover#/?_a=%28index:%27pubsub-rails-inf-pre%27%2Cquery%3A%28language%3Akuery%2Cquery%3A%27json.correlation_id%20%3A%20%2201M25B6JV9WMTAS6E97K3VMAPH%22%27%29%29&_g=%28time%3A%28from%3A%272026-09-09T09:43:31.631Z%27%2Cto%3A%272026-09-10T09:43:31.631Z%27%29%29
            Kibana - Dashboard Url: https://nonprod-log.gitlab.net/app/dashboards#/view/15596340-7570-11ed-9af2-6131f0ee4ce6?_g=%28time%3A%28from:%272026-09-09T09:43:31.631Z%27%2Cto%3A%272026-09-10T09:43:31.631Z%27%29%29&_a=%28filters%3A%21%28%28query%3A%28match_phrase%3A%28json.correlation_id%3A%2701M25B6JV9WMTAS6E97K3VMAPH%27%29%29%29%29%29
          # ./qa/support/page_error_checker.rb:22:in `report!'
          # ./qa/support/page_error_checker.rb:58:in `check_page_for_error_code'
          # ./qa/specs/spec_helper.rb:129:in `block (2 levels) in <top (required)>'
          # /home/gitlab/spec/support/fast_quarantine.rb:22:in `block (2 levels) in <top (required)>'
          # ./qa/specs/runner.rb:125:in `run_rspec'
          # ./qa/specs/runner.rb:32:in `perform'
          # ./qa/scenario/template.rb:10:in `block in perform'
          # ./qa/scenario/template.rb:8:in `perform'
          # ./qa/scenario/template.rb:63:in `perform'
          # ./qa/scenario/template.rb:10:in `block in perform'
          # ./qa/scenario/template.rb:8:in `perform'
          # ./qa/scenario/bootable.rb:52:in `launch!'
Finished in 34.67 seconds (files took 1.03 seconds to load)
1 example, 1 failure
Failed examples:
rspec ./qa/specs/features/ee/browser_ui/2_plan/issue/default_issue_template_spec.rb:14 # Plan Default issue templates uses default template when creating an issue

Sentry / Kibana

  • Correlation ID: 01M25B6JV9WMTAS6E97K3VMAPH
  • Sentry
Edited by 🤖 GitLab Bot 🤖