Error 500 undefined method 'gsub'


I have repo in which i can’t watch commits history and can’t open file

When i try to open file throught web browser self hosted gitlab i see in



Started GET "/" for at 2020-07-08 15:24:20 +0000
Processing by RootController#index as HTML
Completed 200 OK in 346ms (Views: 268.6ms | ActiveRecord: 37.1ms | Elasticsearch: 0.0ms |                     Allocations: 96992)
Started GET "/git_user/raketa_analytics/-/blob/develop/jupyter/analytics_facts.sql" for at   2020-07-08 15:24:23 +0000
Processing by Projects::BlobController#show as HTML
Parameters: {"namespace_id"=>"git_user", "project_id"=>"raketa_analytics", "id"=>"develop/jupyter/analytics_facts.sql"}
Completed 500 Internal Server Error in 88ms (ActiveRecord: 14.8ms | Elasticsearch: 0.0ms | Allocations: 34653)
ActionView::Template::Error (undefined method `gsub' for nil:NilClass):
23:       - if view_details && merge_request
24:         = link_to commit.title, project_commit_path(project,, merge_request_iid:  merge_request.iid), class: ["commit-row-message item-title js-onboarding-commit-item", ("font-italic" if  commit.
25:       - else
26:         = link_to_markdown_field(commit, :title, link, class: "commit-row-message item-title js-onboarding-commit-item #{"font-italic" if commit.message.empty?}")
27:       %span.commit-row-message.d-inline.d-sm-none
28:         ·
29:         = commit.short_id
app/models/project_services/issue_tracker_service.rb:88:in `issue_url'
app/models/project_services/issue_tracker_service.rb:100:in `issue_path'
app/helpers/issues_helper.rb:37:in `url_for_tracker_issue'
app/helpers/issues_helper.rb:26:in `url_for_issue'
lib/banzai/filter/external_issue_reference_filter.rb:86:in `url_for_issue'
lib/banzai/filter/external_issue_reference_filter.rb:71:in `block in issue_link_filter'
lib/banzai/filter/external_issue_reference_filter.rb:26:in `block in references_in'
lib/banzai/filter/external_issue_reference_filter.rb:25:in `gsub'
lib/banzai/filter/external_issue_reference_filter.rb:25:in `references_in'
lib/banzai/filter/external_issue_reference_filter.rb:68:in `issue_link_filter'
lib/banzai/filter/external_issue_reference_filter.rb:40:in `block (2 levels) in call'
lib/banzai/filter/reference_filter.rb:120:in `replace_text_when_pattern_matches'
lib/banzai/filter/external_issue_reference_filter.rb:39:in `block in call'
lib/banzai/filter/reference_filter.rb:97:in `block in each_node'
lib/banzai/filter/reference_filter.rb:96:in `each_node'
lib/banzai/filter/external_issue_reference_filter.rb:37:in `call'
lib/banzai/pipeline/base_pipeline.rb:23:in `block (2 levels) in singleton class'
lib/banzai/renderer.rb:130:in `render_result'
lib/banzai/renderer.rb:161:in `block in cacheless_render'
lib/gitlab/metrics/influx_db.rb:98:in `measure'
lib/banzai/renderer.rb:160:in `cacheless_render'
lib/banzai/renderer.rb:52:in `cacheless_render_field'

I use self hosted gitlab version 12.8.6

Can anybody describe what this error mean? What’s Template::Error (undefined method `gsub’ for nil:NilClass):?


the error means that the method gsub is being invoked on an undefined object. This typically is a programming error as the code should never reach this area, with null checks beforehand.

Please upgrade to the latest stable release and verify that the issue is solved. Also, run possible pending database migration tasks first.


I found the solution

A few weeks ago we enable youtrack integration

This integration enables in general settings menu, and this setting distributed for each repo

But (i don’t know why) in a few repo this internal setting will be blank (enables, but the fields are blank)

I change fields to a right links and all okay!

@dnsmichi A couple days ago i upgrade this gitlab to a new version - of cource it’s not resolve a problem


ah, integrations. Yes, that makes sense. Glad you’ve spotted this yourself. :heart:

The reason I am mentioning upgrades - it is easier to rule out possible changes when everyone uses the same versions, and allows to suggest to create a bug report in case. Older versions like 12.x remain unsupported and are harder to do a changelog and code diff. Hence my suggestion to make it easier for everyone to help each other :slight_smile: