Skip to content

Cannot view old MR changes

Summary

One of our customers tried viewing one of the Changes tab in an old MR and the UI shows the Something went wrong on our end. Please try again! error message.

They only experience this on old MR changes. They are currently using GitLab 13.9.4.

Steps to reproduce

Unfortunately, I wasn't able to reproduce the issue on my end.

What is the current bug behavior?

Shows an error message when viewing an old MR change.

What is the expected correct behavior?

Should show the MR change.

Relevant logs and/or screenshots


NoMethodError (undefined method `paths' for nil:NilClass):

app/services/discussions/capture_diff_note_positions_service.rb:29:in `block in build_discussions'
app/services/discussions/capture_diff_note_positions_service.rb:29:in `each'
app/services/discussions/capture_diff_note_positions_service.rb:29:in `flat_map'
app/services/discussions/capture_diff_note_positions_service.rb:29:in `build_discussions'
lib/gitlab/metrics/instrumentation.rb:160:in `block in build_discussions'
lib/gitlab/metrics/method_call.rb:27:in `measure'
lib/gitlab/metrics/instrumentation.rb:160:in `build_discussions'
app/services/discussions/capture_diff_note_positions_service.rb:12:in `execute'
lib/gitlab/metrics/instrumentation.rb:160:in `block in execute'
lib/gitlab/metrics/method_call.rb:27:in `measure'
lib/gitlab/metrics/instrumentation.rb:160:in `execute'
app/controllers/projects/merge_requests/diffs_controller.rb:188:in `update_diff_discussion_positions!'
ee/lib/gitlab/ip_address_state.rb:10:in `with'
ee/app/controllers/ee/application_controller.rb:44:in `set_current_ip_address'
app/controllers/application_controller.rb:482:in `set_current_admin'
lib/gitlab/session.rb:11:in `with_session' 

I asked them to run these Rails code:

## While inside the Rails console
p = Project.find_by_full_path('project-path')
m = MergeRequest.find_by(project_id: p.id, iid: 13)
active_diff_discussions = m.notes.new_diff_notes.discussions.select do |discussion|
    discussion.active?(m.diff_refs)
end

## Check the value for the first array
pp active_diff_discussions[0].diff_file

The value of active_diff_discussions[0].diff_file is nil causing the error above.

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)


System information
System:		
Proxy:		no
Current User:	git
Using RVM:	no
Ruby Version:	2.7.2p137
Gem Version:	3.1.4
Bundler Version:2.1.4
Rake Version:	13.0.3
Redis Version:	6.0.10
Git Version:	2.29.0
Sidekiq Version:5.2.9
Go Version:	unknown

GitLab information
Version:	13.9.4-ee
Revision:	fb7eeedfaf4
Directory:	/opt/gitlab/embedded/service/gitlab-rails
DB Adapter:	PostgreSQL
DB Version:	12.5
URL:		xxx
HTTP Clone URL:	xxx
SSH Clone URL:	xxx
Elasticsearch:	no
Geo:		no
Using LDAP:	yes
Using Omniauth:	yes
Omniauth Providers: 

GitLab Shell
Version:	13.17.0
Repository storage paths:
- default: 	/var/opt/gitlab/git-data/repositories
GitLab Shell path:		/opt/gitlab/embedded/service/gitlab-shell
Git:		/opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.17.0 ? ... OK (13.17.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: ... Server: ldapmain LDAP authentication... Anonymous. No bind_dn or password configured LDAP users with access to your GitLab server (only showing the first 100 results) User output sanitized. Found 22 users of 100 limit.

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/4 ... yes 4/5 ... yes 3/6 ... yes 5/7 ... yes 2/8 ... yes 6/9 ... yes 5/10 ... yes 5/11 ... yes 5/14 ... yes 8/15 ... yes 4/17 ... yes 6/18 ... yes 2/19 ... yes 11/20 ... yes 3/21 ... yes 4/22 ... yes 2/23 ... yes 5/25 ... yes 2/26 ... yes 5/27 ... yes 3/28 ... yes 15/29 ... yes 4/30 ... yes 3/31 ... yes 3/32 ... yes 6/33 ... yes 4/34 ... yes 4/35 ... yes 15/36 ... yes 4/37 ... yes 13/38 ... yes 11/39 ... yes 13/40 ... yes 14/42 ... yes 6/43 ... yes 4/44 ... yes 6/45 ... yes 5/46 ... yes 13/47 ... yes 17/48 ... yes 4/49 ... yes 5/50 ... yes 2/51 ... yes 3/52 ... yes 5/53 ... yes 3/54 ... yes 2/55 ... yes 4/56 ... yes 15/57 ... yes 4/58 ... yes 15/59 ... yes 6/60 ... yes 5/61 ... yes 5/62 ... yes 4/63 ... yes 4/64 ... yes 17/65 ... yes 5/67 ... yes 3/68 ... yes 5/69 ... yes 3/70 ... yes 5/71 ... yes 5/72 ... yes 15/73 ... yes 15/74 ... yes 15/75 ... yes 5/76 ... yes 2/77 ... yes 15/78 ... yes 15/79 ... yes 15/80 ... yes 14/81 ... yes 14/82 ... yes 17/83 ... yes 19/84 ... yes 18/85 ... yes 21/86 ... yes 15/87 ... yes 4/89 ... yes 2/90 ... yes 19/91 ... yes 22/92 ... yes 6/93 ... yes 14/94 ... yes 18/95 ... yes 20/96 ... yes 13/97 ... yes 19/98 ... yes 19/99 ... yes 4/100 ... yes 4/101 ... yes 3/102 ... yes 19/103 ... yes 4/104 ... yes 17/105 ... yes 3/106 ... yes 3/107 ... yes 17/108 ... yes 10/109 ... yes 15/110 ... yes 28/111 ... yes 28/112 ... yes 15/113 ... yes 14/114 ... yes 10/115 ... yes 5/116 ... yes 3/117 ... yes 5/118 ... yes 28/119 ... yes 17/121 ... yes 27/122 ... yes 11/124 ... yes 13/125 ... yes 27/126 ... yes 10/127 ... yes 27/128 ... yes 13/129 ... yes 28/130 ... yes 14/131 ... yes 10/132 ... yes 10/133 ... yes 3/134 ... yes 3/135 ... yes 14/137 ... yes 3/139 ... yes 17/140 ... yes 3/142 ... yes 18/143 ... yes 3/144 ... yes 27/146 ... yes 15/147 ... yes 5/148 ... yes 27/149 ... yes 10/150 ... yes 27/151 ... yes 10/152 ... yes 10/153 ... yes 5/154 ... yes 17/155 ... yes 17/156 ... yes 19/157 ... yes 28/158 ... yes 19/159 ... yes 2/160 ... yes 5/161 ... yes 10/162 ... yes 7/163 ... yes 6/164 ... yes 6/165 ... yes 27/166 ... yes 4/167 ... yes 27/168 ... yes 13/169 ... yes 28/170 ... yes 17/171 ... yes 19/172 ... yes 10/173 ... yes 17/174 ... yes 18/176 ... yes 27/177 ... yes 6/178 ... yes 3/179 ... yes 28/180 ... yes 4/181 ... yes 19/182 ... yes 6/183 ... yes 27/184 ... yes 3/185 ... yes 6/186 ... yes 10/187 ... yes 4/188 ... yes 15/189 ... yes 28/190 ... yes 4/191 ... yes 4/192 ... yes 10/193 ... yes 27/194 ... yes 10/195 ... yes 29/196 ... yes 10/198 ... yes 10/199 ... yes 28/200 ... yes 11/201 ... yes 27/202 ... yes 28/203 ... yes 28/204 ... yes 10/205 ... yes 10/206 ... yes 10/207 ... yes 5/208 ... yes 12/209 ... yes 30/210 ... yes 17/211 ... yes 3/212 ... yes 20/213 ... yes 6/214 ... yes 18/215 ... yes 6/216 ... yes 12/217 ... yes 27/218 ... yes 2/219 ... yes 4/220 ... yes 30/221 ... yes 15/222 ... yes 20/223 ... yes 30/224 ... yes 6/225 ... yes 28/226 ... yes 7/227 ... yes 3/228 ... yes 2/229 ... yes 18/230 ... yes 17/231 ... yes 30/232 ... yes 10/233 ... yes 27/234 ... yes 17/235 ... yes 7/236 ... yes 4/237 ... yes 30/238 ... yes 4/239 ... yes 30/240 ... yes 30/241 ... yes 2/242 ... yes 28/244 ... yes 4/245 ... yes 27/246 ... yes 22/247 ... yes 4/248 ... yes 28/249 ... yes 12/250 ... yes 22/251 ... yes 28/252 ... yes 30/253 ... yes 31/254 ... yes 31/255 ... yes 17/257 ... yes 4/258 ... yes 31/259 ... yes 17/260 ... yes 31/261 ... yes 17/262 ... yes 13/263 ... yes 2/264 ... yes 2/265 ... yes 17/266 ... yes 17/267 ... yes 2/268 ... yes 30/269 ... yes 31/270 ... yes 46/271 ... yes 6/272 ... yes 5/273 ... yes 6/274 ... yes 28/275 ... yes 31/276 ... yes 3/277 ... yes 15/278 ... yes 30/279 ... yes 6/280 ... yes 32/281 ... yes 27/282 ... yes 32/283 ... yes 6/284 ... yes 33/285 ... yes 28/286 ... yes 4/287 ... yes 28/288 ... yes 28/289 ... yes 28/290 ... yes 27/291 ... yes 32/292 ... yes 28/293 ... yes 34/294 ... yes 34/295 ... yes 17/296 ... yes 10/297 ... yes 7/298 ... yes 2/299 ... yes 31/300 ... yes 34/302 ... yes 4/303 ... yes 27/304 ... yes 3/305 ... yes 30/306 ... yes 30/307 ... yes 31/308 ... yes 28/309 ... yes 30/310 ... yes 27/311 ... yes 31/312 ... yes 7/313 ... yes 3/314 ... yes 28/315 ... yes 6/316 ... yes 30/317 ... yes 4/318 ... yes 4/319 ... yes 28/321 ... yes 36/322 ... yes 36/323 ... yes 36/324 ... yes 36/325 ... yes 4/326 ... yes 27/327 ... yes 7/328 ... yes 30/329 ... yes 15/330 ... yes 27/331 ... yes 22/332 ... yes 31/333 ... yes 28/334 ... yes 6/335 ... yes 5/336 ... yes 3/337 ... yes 28/338 ... yes 31/339 ... yes 5/340 ... yes 34/341 ... yes 32/342 ... yes 28/343 ... yes 28/344 ... yes 31/345 ... yes 6/346 ... yes 6/347 ... yes 28/348 ... yes 21/349 ... yes 31/350 ... yes 31/351 ... yes 21/352 ... yes 5/354 ... yes 5/355 ... yes 30/356 ... yes 31/357 ... yes 5/358 ... yes 5/359 ... yes 30/360 ... yes 34/361 ... yes 30/362 ... yes 31/363 ... yes 6/364 ... yes 32/365 ... yes 32/366 ... yes 30/367 ... yes 6/368 ... yes 27/369 ... yes 12/370 ... yes 15/371 ... yes 6/372 ... yes 31/373 ... yes 31/374 ... yes 28/375 ... yes 4/376 ... yes 17/378 ... yes 42/379 ... yes 40/380 ... yes 4/381 ... yes 6/382 ... yes 43/383 ... yes 28/384 ... yes 41/385 ... yes 5/386 ... yes 30/387 ... yes 40/388 ... yes 10/389 ... yes 10/390 ... yes 40/391 ... yes 10/392 ... yes 15/393 ... yes 31/394 ... yes 10/395 ... yes 21/396 ... yes 34/397 ... yes 31/399 ... yes 31/400 ... yes 31/401 ... yes 6/402 ... yes 22/403 ... yes 28/404 ... yes 28/405 ... yes 6/406 ... yes 34/407 ... yes 27/408 ... yes 10/409 ... yes 30/410 ... yes 6/411 ... yes 10/412 ... yes 31/413 ... yes 4/414 ... yes 31/415 ... yes 5/416 ... yes 15/417 ... yes 45/418 ... yes 2/419 ... yes 30/420 ... yes 45/421 ... yes 30/422 ... yes 31/423 ... yes 30/424 ... yes 31/425 ... yes 21/426 ... yes 21/427 ... yes 13/428 ... yes 40/429 ... yes 28/430 ... yes 28/431 ... yes 21/432 ... yes 30/433 ... yes 45/436 ... yes 15/437 ... yes 27/438 ... yes 31/439 ... yes 2/440 ... yes 38/441 ... yes 30/442 ... yes 30/444 ... yes 13/445 ... yes 5/446 ... yes 27/447 ... yes 28/448 ... yes 3/449 ... yes 10/450 ... yes 34/451 ... yes 33/452 ... yes 28/453 ... yes 46/454 ... yes 28/456 ... yes 4/457 ... yes 46/458 ... yes 3/459 ... yes 6/460 ... yes 21/461 ... yes 6/462 ... yes 30/463 ... yes 30/464 ... yes 4/465 ... yes 4/466 ... yes 2/467 ... yes 14/468 ... yes 4/469 ... yes 6/470 ... yes 7/471 ... yes 6/472 ... yes 34/473 ... yes 3/474 ... yes 34/475 ... yes 4/476 ... yes 3/477 ... yes 7/479 ... yes 31/480 ... yes 12/481 ... yes 14/482 ... yes 30/483 ... yes 13/484 ... yes 31/485 ... yes 38/486 ... yes 31/487 ... yes 32/488 ... yes 27/489 ... yes 21/490 ... yes 27/491 ... yes 17/493 ... yes 27/495 ... yes 4/496 ... yes 34/497 ... yes 5/498 ... yes 27/499 ... yes 28/500 ... yes 14/501 ... yes 5/503 ... yes 31/504 ... yes 27/505 ... yes 27/506 ... yes 28/507 ... yes 13/508 ... yes 28/509 ... yes 15/510 ... yes 2/511 ... yes 30/512 ... yes 5/513 ... yes 31/514 ... yes 34/515 ... yes 30/516 ... yes 27/517 ... yes 3/518 ... yes 30/519 ... yes 28/520 ... yes 17/521 ... yes 5/522 ... yes 4/523 ... yes 3/524 ... yes 27/525 ... yes 6/527 ... yes 17/528 ... yes 4/529 ... yes 5/530 ... yes 3/531 ... yes 27/532 ... yes 28/533 ... yes 17/534 ... yes 10/536 ... yes 17/537 ... yes 10/538 ... yes 21/539 ... yes 6/540 ... yes 3/541 ... yes 3/542 ... yes 32/543 ... yes 4/544 ... yes 31/545 ... yes 4/546 ... yes 10/547 ... yes 30/548 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.7.2 ? ... yes (2.7.2) Git version >= 2.29.0 ? ... yes (2.29.0) Git user has default SSH configuration? ... yes Active users: ... 22 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... no Try fixing it: Please migrate all projects to hashed storage as legacy storage is deprecated in 13.0 and support will be removed in 14.0. For more information see: doc/administration/repository_storage_types.md Elasticsearch version 7.x (6.4 - 6.x deprecated to be removed in 13.8)? ... skipped (elasticsearch is disabled)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

Edited by Nourdin el Bacha