Error 500 after trying to create a merge request

Hello guys,

when i try to create a merge request in any project, i get the error 500.
The log gives me this error

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

TypeError (wrong argument type nil (expected String)):
  lib/gitlab/metrics/instrumentation.rb:159:in `block in rev_parse'
  lib/gitlab/metrics/method_call.rb:36:in `measure'
  lib/gitlab/metrics/instrumentation.rb:159:in `rev_parse'
  lib/gitlab/git/repository.rb:490:in `rev_parse_target'
  lib/gitlab/git/repository.rb:1869:in `sha_from_ref'
  lib/gitlab/git/repository.rb:457:in `raw_log'
  lib/gitlab/git/repository.rb:446:in `block in log'
  lib/gitlab/gitaly_client.rb:289:in `block (2 levels) in migrate'
  lib/gitlab/gitaly_client.rb:333:in `allow_n_plus_1_calls'
  lib/gitlab/gitaly_client.rb:282:in `block in migrate'
  lib/gitlab/metrics/influx_db.rb:103:in `measure'
  lib/gitlab/gitaly_client.rb:280:in `migrate'
  lib/gitlab/git/repository.rb:1166:in `gitaly_migrate'
  lib/gitlab/git/repository.rb:442:in `log'
  lib/gitlab/git/commit.rb:41:in `where'
  app/models/repository.rb:150:in `commits'
  lib/gitlab/metrics/instrumentation.rb:159:in `block in commits'
  lib/gitlab/metrics/method_call.rb:36:in `measure'
  lib/gitlab/metrics/instrumentation.rb:159:in `commits'
  ee/lib/gitlab/authority_analyzer.rb:23:in `involved_users'
  ee/lib/gitlab/authority_analyzer.rb:12:in `calculate'
  ee/app/controllers/ee/projects/merge_requests/application_controller.rb:14:in `set_suggested_approvers'
  ee/app/controllers/ee/projects/merge_requests/creations_controller.rb:11:in `define_new_vars'
  app/controllers/projects/merge_requests/creations_controller.rb:17:in `block in new'
  lib/gitlab/gitaly_client.rb:333:in `allow_n_plus_1_calls'
  app/controllers/projects/merge_requests/creations_controller.rb:16:in `new'
  lib/gitlab/i18n.rb:51:in `with_locale'
  lib/gitlab/i18n.rb:57:in `with_user_locale'
  app/controllers/application_controller.rb:370:in `set_locale'
  lib/gitlab/middleware/multipart.rb:97:in `call'
  lib/gitlab/request_profiler/middleware.rb:14:in `call'
  ee/lib/gitlab/jira/middleware.rb:15:in `call'
  lib/gitlab/middleware/go.rb:17:in `call'
  lib/gitlab/etag_caching/middleware.rb:11:in `call'
  lib/gitlab/middleware/rails_queue_duration.rb:22:in `call'
  lib/gitlab/metrics/rack_middleware.rb:15:in `block in call'
  lib/gitlab/metrics/transaction.rb:53:in `run'
  lib/gitlab/metrics/rack_middleware.rb:15:in `call'
  lib/gitlab/middleware/read_only/controller.rb:38:in `call'
  lib/gitlab/middleware/read_only.rb:16:in `call'
  lib/gitlab/request_context.rb:18:in `call'
  lib/gitlab/metrics/requests_rack_middleware.rb:27:in `call'
  lib/gitlab/middleware/release_env.rb:10:in `call'

Does someone know how to fix this?

If you could let us know more about your setup (e.g. self-hosted or hosted on gitlab.com, free plan or paid plan, GitLab version if self-hosted, etc), that’d help folks being able to better answer your question. Thanks!

Going to leave this here:
We are using a high availability solution, self-hosted, free plan.
Gitlab v11.1.4

After some hours of research i found out this was a bug on this gitlab version.
There are 2 fixes for this:
1 - Update gitlab to v11.2+
2 - run this command :
sudo gitlab-rails r ‘Feature.enable(:gitaly_find_commits)’

Do a gitlab-ctl restart for safe measures.
Voila merge requests are working.

Thank you for you availability anyway @dplanella

1 Like

Thanks for sharing the solution and marking the topic as solved!