500 error when access settings in the Admin area

It seems since upgrading from Gitlab ce 12.9.7 to 12.10.8 (from rpm), when click on the ‘Admin’ icon, going to ‘Settings’ -> ‘General’, the page shows 500 error and the following shows in my log:

Started GET “/admin/application_settings/general” for 192.168.10.198 at 2020-06-02 13:07:30 +0800
Processing by Gitlab::RequestForgeryProtection::Controller#index as HTML
Completed 200 OK in 0ms (ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 92)
Processing by Gitlab::RequestForgeryProtection::Controller#index as HTML
Completed 200 OK in 0ms (ActiveRecord: 0.0ms | Elasticsearch: 0.0ms | Allocations: 92)
Processing by Admin::ApplicationSettingsController#general as HTML
Completed 500 Internal Server Error in 248ms (ActiveRecord: 30.7ms | Elasticsearch: 0.0ms | Allocations: 335175)

ActionView::Template::Error ():
36: = external_authorization_client_certificate_help_text
37: .form-group
38: = f.label :external_auth_client_key, _(‘Client authentication key’), class: ‘label-bold’
39: = f.text_area :external_auth_client_key, class: ‘form-control’
40: %span.form-text.text-muted
41: = external_authorization_client_key_help_text
42: .form-group

app/views/admin/application_settings/_external_authorization_service_form.html.haml:39
app/views/admin/application_settings/_external_authorization_service_form.html.haml:11
app/views/admin/application_settings/general.html.haml:71
app/controllers/application_controller.rb:125:in render' app/controllers/application_controller.rb:479:in set_current_admin’
lib/gitlab/session.rb:11:in `with_session’

Thank you very much for helping me solve the problem.

1 Like

Hi @TomRobust-2020, welcome to the GitLab community forum! :tada:

I suggest you try the following:

  • log out of GitLab as Admin user
  • run gitlab-ctl reconfigure on the GitLab server
  • run gitlab-ctl restart on the GitLab server
  • login to GitLab as an Admin user
  • navigate to any <external_url>/admin URL

If this does not work, can you please share the output of sudo gitlab-rake gitlab:env:info && sudo gitlab-rake gitlab:check SANITIZE=true

Thanks!

Hi @gitlab-greg, unfortunately, i have tried the way ahead but it have no effect, the following is the output of checking info:

System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.6.6p146
Gem Version: 2.7.10
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version: 5.0.7
Git Version: 2.26.2
Sidekiq Version:5.2.7
Go Version: unknown

GitLab information
Version: 12.10.8
Revision: c9fc139d1d7
Directory: /opt/gitlab/embedded/service/gitlab-rails
DB Adapter: PostgreSQL
DB Version: 11.7
URL: http://192.168.10.100:8080
HTTP Clone URL: http://192.168.10.100:8080/some-group/some-project.git
SSH Clone URL: git@192.168.10.100:some-group/some-project.git
Using LDAP: no
Using Omniauth: yes
Omniauth Providers:

GitLab Shell
Version: 12.2.0
Repository storage paths:

  • default: /home/data/git-data/repositories
    GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell
    Git: /opt/gitlab/embedded/bin/git
    Checking GitLab subtasks …

Checking GitLab Shell …

GitLab Shell: … GitLab Shell version >= 12.2.0 ? … OK (12.2.0)
Running /opt/gitlab/embedded/service/gitlab-shell/bin/check
Internal API available: OK
Redis available via internal API: OK
gitlab-shell self-check successful

Checking GitLab Shell … Finished

Checking Gitaly …

Gitaly: … default … OK

Checking Gitaly … Finished

Checking Sidekiq …

Sidekiq: … Running? … yes
Number of Sidekiq processes … 1

Checking Sidekiq … Finished

Checking Incoming Email …

Incoming Email: … Reply by email is disabled in config/gitlab.yml

Checking Incoming Email … Finished

Checking LDAP …

LDAP: … LDAP is disabled in config/gitlab.yml

Checking LDAP … Finished

Checking GitLab App …

Git configured correctly? … yes
Database config exists? … yes
All migrations up? … yes
Database contains orphaned GroupMembers? … no
GitLab config exists? … yes
GitLab config up to date? … yes
Log directory writable? … yes
Tmp directory writable? … yes
Uploads directory exists? … yes
Uploads directory has correct permissions? … yes
Uploads directory tmp has correct permissions? … yes
Init script exists? … skipped (omnibus-gitlab has no init script)
Init script up-to-date? … skipped (omnibus-gitlab has no init script)
Projects have namespace: …
5/1 … yes
8/2 … yes
8/3 … yes
8/4 … yes
9/5 … yes
9/6 … yes
9/7 … yes
20/8 … yes
20/9 … yes
20/10 … yes
5/11 … yes
5/13 … yes
5/14 … yes
5/15 … yes
5/16 … yes
24/18 … yes
17/20 … yes
25/21 … yes
25/23 … yes
25/24 … yes
25/25 … yes
25/26 … yes
25/27 … yes
25/28 … yes
25/29 … yes
12/30 … yes
10/31 … yes
5/32 … yes
10/35 … yes
26/36 … yes
26/37 … yes
26/38 … yes
26/39 … yes
26/40 … yes
26/42 … yes
26/43 … yes
27/44 … yes
26/45 … yes
26/46 … yes
25/47 … yes
22/48 … yes
30/49 … yes
31/50 … yes
31/51 … yes
31/52 … yes
31/53 … yes
33/54 … yes
33/55 … yes
25/57 … yes
26/58 … yes
26/59 … yes
34/60 … yes
34/61 … yes
22/62 … yes
17/68 … yes
5/69 … yes
5/70 … yes
25/71 … yes
25/72 … yes
38/73 … yes
38/74 … yes
6/77 … yes
6/78 … yes
41/79 … yes
41/80 … yes
6/83 … yes
6/84 … yes
6/85 … yes
26/86 … yes
26/87 … yes
44/88 … yes
44/89 … yes
44/90 … yes
44/91 … yes
45/92 … yes
25/94 … yes
44/95 … yes
26/96 … yes
26/97 … yes
26/98 … yes
38/100 … yes
38/101 … yes
6/102 … yes
6/103 … yes
6/104 … yes
6/105 … yes
44/106 … yes
26/107 … yes
32/108 … yes
26/109 … yes
32/110 … yes
13/111 … yes
26/112 … yes
26/113 … yes
49/114 … yes
Redis version >= 4.0.0? … yes
Ruby version >= 2.5.3 ? … yes (2.6.6)
Git version >= 2.22.0 ? … yes (2.26.2)
Git user has default SSH configuration? … yes
Active users: … 21
Is authorized keys file accessible? … skipped (authorized keys not enabled)

Checking GitLab App … Finished

Checking GitLab subtasks … Finished

Thanks a lot!

Strangely, only when click on “Settings”->“General”, the 500 error occurs, and the others, such as “integrations”, “preferences” , is ok.

So, It’s been bothering me for a long time.

Thanks!

The same thing happened to my gitlab

i have the same problem, update gitlab to last version 13.1.0

==> /var/log/gitlab/gitlab-rails/production_json.log <== {"method":"GET","path":"/admin/application_settings/general","format":"html","controller":"Admin::ApplicationSettingsController","action":"general","status":500,"time":"2020-06-22T17:23:29.973Z","params":[],"remote_ip":"86.126.81.150","user_id":2,"username":"vukomir","ua":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:77.0) Gecko/20100101 Firefox/77.0","correlation_id":"atOgTOu4mC3","meta.user":"vukomir","meta.caller_id":"Admin::ApplicationSettingsController#general","redis_calls":1,"redis_duration_s":0.000348,"redis_read_bytes":407,"redis_write_bytes":587,"redis_shared_state_calls":1,"redis_shared_state_duration_s":0.000348,"redis_shared_state_read_bytes":407,"redis_shared_state_write_bytes":587,"cpu_s":0.18,"exception.class":"ActionView::Template::Error","exception.message":"undefined method first’ for nil:NilClass",“exception.backtrace”:[“app/models/application_setting_implementation.rb:314:in pick_repository_storage'","lib/gitlab/current_settings.rb:20:in method_missing’”,“app/models/concerns/has_repository.rb:23:in pick_repository_storage'","app/models/project.rb:72:in block in class:Project’”,“app/models/project.rb:727:in initialize'","app/views/admin/application_settings/_visibility_and_access.html.haml:15","app/views/admin/application_settings/_visibility_and_access.html.haml:1","app/views/admin/application_settings/general.html.haml:14","app/controllers/application_controller.rb:133:in render’”,“app/controllers/application_controller.rb:497:in set_current_admin'","lib/gitlab/session.rb:11:in with_session’”,“app/controllers/application_controller.rb:488:in set_session_storage'","app/controllers/application_controller.rb:482:in set_locale’”,“lib/gitlab/error_tracking.rb:51:in with_context'","app/controllers/application_controller.rb:547:in sentry_context’”,“app/controllers/application_controller.rb:475:in block in set_current_context'","lib/gitlab/application_context.rb:52:in block in use’”,“lib/gitlab/application_context.rb:52:in use'","lib/gitlab/application_context.rb:20:in with_context’”,“app/controllers/application_controller.rb:468:in `set_current_context’”],“db_duration_s”:0.00884,“view_duration_s”:0.0,“duration_s”:0.16928}

==> /var/log/gitlab/gitlab-rails/production.log <==

ActionView::Template::Error (undefined method `first’ for nil:NilClass):
12: = render_if_exists ‘admin/application_settings/default_project_deletion_adjourned_period_setting’, form: f
13: .form-group.visibility-level-setting
14: = f.label :default_project_visibility, class: ‘label-bold’
15: = render(‘shared/visibility_radios’, model_method: :default_project_visibility, form: f, selected_level: @application_setting.default_project_visibility, form_model: Project.new)
16: .form-group.visibility-level-setting
17: = f.label :default_snippet_visibility, class: ‘label-bold’
18: = render(‘shared/visibility_radios’, model_method: :default_snippet_visibility, form: f, selected_level: @application_setting.default_snippet_visibility, form_model: ProjectSnippet.new)

app/models/application_setting_implementation.rb:314:in pick_repository_storage' lib/gitlab/current_settings.rb:20:in method_missing’
app/models/concerns/has_repository.rb:23:in pick_repository_storage' app/models/project.rb:72:in block in class:Project
app/models/project.rb:727:in initialize' app/views/admin/application_settings/_visibility_and_access.html.haml:15 app/views/admin/application_settings/_visibility_and_access.html.haml:1 app/views/admin/application_settings/general.html.haml:14 app/controllers/application_controller.rb:133:in render’
app/controllers/application_controller.rb:497:in set_current_admin' lib/gitlab/session.rb:11:in with_session’
app/controllers/application_controller.rb:488:in set_session_storage' lib/gitlab/i18n.rb:55:in with_locale’
lib/gitlab/i18n.rb:61:in with_user_locale' app/controllers/application_controller.rb:482:in set_locale’
lib/gitlab/error_tracking.rb:51:in with_context' app/controllers/application_controller.rb:547:in sentry_context’
app/controllers/application_controller.rb:475:in block in set_current_context' lib/gitlab/application_context.rb:52:in block in use’
lib/gitlab/application_context.rb:52:in use' lib/gitlab/application_context.rb:20:in with_context’
app/controllers/application_controller.rb:468:in set_current_context' lib/gitlab/request_profiler/middleware.rb:17:in call’
lib/gitlab/middleware/go.rb:20:in call' lib/gitlab/etag_caching/middleware.rb:13:in call’
lib/gitlab/middleware/multipart.rb:125:in call' lib/gitlab/middleware/read_only/controller.rb:51:in call’
lib/gitlab/middleware/read_only.rb:18:in call' lib/gitlab/middleware/same_site_cookies.rb:27:in call’
lib/gitlab/middleware/basic_health_check.rb:25:in call' lib/gitlab/middleware/handle_ip_spoof_attack_error.rb:25:in call’
lib/gitlab/middleware/request_context.rb:23:in call' config/initializers/fix_local_cache_middleware.rb:9:in call’
lib/gitlab/metrics/requests_rack_middleware.rb:60:in call' lib/gitlab/middleware/release_env.rb:12:in call’
`

`root@gitlab:/# gitlab-rake gitlab:env:info --trace
** Invoke gitlab:env:info (first_time)
** Invoke gitlab_environment (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute gitlab_environment
** Execute gitlab:env:info

System information
System:
Current User: git
Using RVM: no
Ruby Version: 2.6.6p146
Gem Version: 2.7.10
Bundler Version:1.17.3
Rake Version: 12.3.3
Redis Version: 5.0.9
Git Version: 2.27.0
Sidekiq Version:5.2.7
Go Version: unknown
rake aborted!
NoMethodError: undefined method first' for nil:NilClass /opt/gitlab/embedded/service/gitlab-rails/app/models/application_setting_implementation.rb:314:in pick_repository_storage’
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/current_settings.rb:20:in method_missing' /opt/gitlab/embedded/service/gitlab-rails/app/models/concerns/has_repository.rb:23:in pick_repository_storage’
/opt/gitlab/embedded/service/gitlab-rails/app/models/project.rb:72:in block in <class:Project>' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/default_value_for-3.3.0/lib/default_value_for.rb:43:in evaluate’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/default_value_for-3.3.0/lib/default_value_for.rb:185:in block in set_default_values' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/default_value_for-3.3.0/lib/default_value_for.rb:155:in each’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/default_value_for-3.3.0/lib/default_value_for.rb:155:in set_default_values' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:428:in block in make_lambda’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:238:in block in halting_and_conditional' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:517:in block in invoke_after’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:517:in each' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:517:in invoke_after’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:136:in run_callbacks' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.1/lib/active_support/callbacks.rb:825:in _run_initialize_callbacks’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/core.rb:328:in initialize' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/default_value_for-3.3.0/lib/default_value_for.rb:143:in initialize’
/opt/gitlab/embedded/service/gitlab-rails/app/models/project.rb:727:in initialize' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/inheritance.rb:70:in new’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/inheritance.rb:70:in new' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/reflection.rb:158:in build_association’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/associations/association.rb:321:in build_record' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/associations/collection_association.rb:108:in build’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/activerecord-6.0.3.1/lib/active_record/associations/collection_proxy.rb:316:in build' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/info.rake:48:in block (3 levels) in <top (required)>’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in block in execute' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in each’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:273:in execute' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:214:in block in invoke_with_call_chain’
/opt/gitlab/embedded/lib/ruby/2.6.0/monitor.rb:235:in mon_synchronize' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:194:in invoke_with_call_chain’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task.rb:183:in invoke' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:160:in invoke_task’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in block (2 levels) in top_level' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in each’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in block in top_level' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:125:in run_with_threads’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:110:in top_level' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:83:in block in run’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:186:in standard_exception_handling' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:80:in run’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/rake-12.3.3/exe/rake:27:in <top (required)>' /opt/gitlab/embedded/bin/rake:23:in load’
/opt/gitlab/embedded/bin/rake:23:in <top (required)>' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in load’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in kernel_load' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in run’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in exec' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in run’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in invoke_command' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in dispatch’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in dispatch' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in start’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in start' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:30:in block in <top (required)>’
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in with_friendly_errors' /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/bundler-1.17.3/exe/bundle:22:in <top (required)>’
/opt/gitlab/embedded/bin/bundle:23:in load' /opt/gitlab/embedded/bin/bundle:23:in
Tasks: TOP => gitlab:env:info
`

I hit this same problem (only with General, all other Settings areas work fine) after doing an upgrade from 12 to 13 of the omnibus edition. If it matters, I’m running this in a docker container on a Synology DiskStation.

I’ve tried gitlab-rake cache:clear and many other things that were recommended in other reports. The output of my gitlab-rake gitlab:env:info does indicate a problem, not sure if that’s related or not.

# gitlab-rake gitlab:env:info 

System information
System:		
Current User:	git
Using RVM:	no
Ruby Version:	2.6.6p146
Gem Version:	2.7.10
Bundler Version:1.17.3
Rake Version:	12.3.3
Redis Version:	5.0.9
Git Version:	2.27.0
Sidekiq Version:5.2.7
Go Version:	unknown
rake aborted!
NoMethodError: undefined method `first' for nil:NilClass
/opt/gitlab/embedded/service/gitlab-rails/app/models/application_setting_implementation.rb:314:in `pick_repository_storage'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/current_settings.rb:20:in `method_missing'
/opt/gitlab/embedded/service/gitlab-rails/app/models/concerns/has_repository.rb:23:in `pick_repository_storage'
/opt/gitlab/embedded/service/gitlab-rails/app/models/project.rb:72:in `block in <class:Project>'
/opt/gitlab/embedded/service/gitlab-rails/app/models/project.rb:727:in `initialize'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/info.rake:48:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:23:in `load'
/opt/gitlab/embedded/bin/bundle:23:in `<main>'
Tasks: TOP => gitlab:env:info
(See full trace by running task with --trace)

solved in: #223958

1 Like

How so resolved? I am facing the same problem!

The workaround is described here: https://gitlab.com/gitlab-org/gitlab/-/issues/223958
quote:
“I was able to fix this by going to /admin/application_settings/repository and clicking on Repository Storage, then pressing Save Changes to set the weight for default as 0”