[go: up one dir, main page]

Skip to content

NoMethodError: Repositories::LfsLocksApiController#verify - undefined method `id' for nil:NilClass

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

Problem

Sentry error: https://new-sentry.gitlab.net/organizations/gitlab/issues/1299955

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

      groups = locks.partition { |lock| lock.user_id == user.id }
                                                            ^^^
  from app/controllers/repositories/lfs_locks_api_controller.rb:61:in `block in split_by_owner'
  from active_record/relation/delegation.rb:88:in `each'
  from active_record/relation/delegation.rb:88:in `each'
  from app/controllers/repositories/lfs_locks_api_controller.rb:61:in `partition'
  from app/controllers/repositories/lfs_locks_api_controller.rb:61:in `split_by_owner'
  from app/controllers/repositories/lfs_locks_api_controller.rb:32:in `verify'

Proposal

  • Try to reproduce this error
  • Handle the case when the user is missing
  • Add a test for this case
Edited by 🤖 GitLab Bot 🤖