Internal server error while trying to move project into another group through API

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

Summary

I got 500 Internal Server Error on such API request, which should move project to another group:

[POST] groups/253/projects/139 {"name"=>"139", "path"=>"139", "description"=>"XXX", "wiki_enabled"=>false, "snippets_enabled"=>false, "issues_enabled"=>true, "visibility"=>"private", "namespace_id"=>"253"}

Steps to reproduce

I don't know how exactly reproduce this behavior, some other projects were moved successfully.

Relevant logs and/or screenshots

NoMethodError: undefined method `id' for nil:NilClass
  from labels/transfer_service.rb:63:in `find_or_create_label!'
  from labels/transfer_service.rb:18:in `block (2 levels) in execute'
  from active_record/relation/batches.rb:51:in `block (2 levels) in find_each'
  from active_record/relation/batches.rb:51:in `each'
  from active_record/relation/batches.rb:51:in `block in find_each'
  from active_record/relation/batches.rb:124:in `find_in_batches'
  from active_record/relation/batches.rb:50:in `find_each'
  from labels/transfer_service.rb:17:in `block in execute'
  from active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
  from active_record/transactions.rb:220:in `transaction'
  from labels/transfer_service.rb:16:in `execute'
  from projects/transfer_service.rb:69:in `block in attempt_transfer_transaction'
  from active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
  from active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
  from active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
  from active_record/transactions.rb:220:in `transaction'
  from projects/transfer_service.rb:57:in `attempt_transfer_transaction'
  from projects/transfer_service.rb:53:in `transfer'
  from projects/transfer_service.rb:25:in `execute'
  from api/groups.rb:231:in `block (2 levels) in <class:Groups>'
  from grape/endpoint.rb:57:in `call'
  from grape/endpoint.rb:57:in `block (2 levels) in generate_api_method'
  from active_support/notifications.rb:166:in `instrument'
  from grape/endpoint.rb:56:in `block in generate_api_method'
  from grape/endpoint.rb:262:in `block in run'
  from active_support/notifications.rb:166:in `instrument'
  from grape/endpoint.rb:243:in `run'
  from grape/endpoint.rb:313:in `block in build_stack'
  from grape/middleware/base.rb:31:in `call!'
  from grape/middleware/base.rb:24:in `call'
  from grape/middleware/base.rb:31:in `call!'
  from grape/middleware/base.rb:24:in `call'
  from rack/oauth2/server/resource.rb:20:in `call'
  from rack/oauth2/server/resource/bearer.rb:8:in `call'
  from grape/middleware/error.rb:37:in `block in call!'
  from grape/middleware/error.rb:36:in `catch'
  from grape/middleware/error.rb:36:in `call!'
  from grape/middleware/base.rb:24:in `call'
  from grape_logging/middleware/request_logger.rb:60:in `block in call!'
  from grape_logging/middleware/request_logger.rb:58:in `catch'
  from grape_logging/middleware/request_logger.rb:58:in `call!'
  from grape/middleware/base.rb:24:in `call'
  from rack/head.rb:13:in `call'
  from grape/endpoint.rb:227:in `call!'
  from grape/endpoint.rb:221:in `call'
  from grape/router/route.rb:72:in `exec'
  from grape/router.rb:121:in `process_route'
  from grape/router.rb:74:in `block in identity'
  from grape/router.rb:93:in `transaction'
  from grape/router.rb:72:in `identity'
  from grape/router.rb:57:in `block in call'
  from grape/router.rb:137:in `with_optimization'
  from grape/router.rb:56:in `call'
  from grape/api.rb:119:in `call'
  from grape/api.rb:45:in `call!'
  from grape/api.rb:40:in `call'
  from action_dispatch/routing/mapper.rb:51:in `serve'
  from action_dispatch/journey/router.rb:43:in `block in serve'
  from action_dispatch/journey/router.rb:30:in `each'
  from action_dispatch/journey/router.rb:30:in `serve'
  from action_dispatch/routing/route_set.rb:817:in `call'
  from omniauth/strategy.rb:415:in `call_app!'
  from omniauth/strategies/saml.rb:86:in `other_phase'
  from omniauth/strategy.rb:189:in `call!'
  from omniauth/strategy.rb:168:in `call'
  from gitlab/middleware/multipart.rb:95:in `call'
  from gitlab/request_profiler/middleware.rb:14:in `call'
  from gitlab/middleware/go.rb:17:in `call'
  from gitlab/etag_caching/middleware.rb:11:in `call'
  from batch_loader/middleware.rb:11:in `call'
  from rack/attack.rb:107:in `call'
  from warden/manager.rb:36:in `block in call'
  from warden/manager.rb:35:in `catch'
  from warden/manager.rb:35:in `call'
  from rack/cors.rb:97:in `call'
  from rack/etag.rb:24:in `call'
  from rack/conditionalget.rb:38:in `call'
  from rack/head.rb:13:in `call'
  from action_dispatch/middleware/params_parser.rb:27:in `call'
  from gitlab/middleware/read_only/controller.rb:28:in `call'
  from gitlab/middleware/read_only.rb:16:in `call'
  from action_dispatch/middleware/flash.rb:260:in `call'
  from rack/session/abstract/id.rb:225:in `context'
  from rack/session/abstract/id.rb:220:in `call'
  from action_dispatch/middleware/cookies.rb:560:in `call'
  from active_record/query_cache.rb:36:in `call'
  from active_record/connection_adapters/abstract/connection_pool.rb:653:in `call'
  from action_dispatch/middleware/callbacks.rb:29:in `block in call'
  from active_support/callbacks.rb:88:in `__run_callbacks__'
  from active_support/callbacks.rb:778:in `_run_call_callbacks'
  from active_support/callbacks.rb:81:in `run_callbacks'
  from action_dispatch/middleware/callbacks.rb:27:in `call'
  from action_dispatch/middleware/remote_ip.rb:78:in `call'
  from action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  from action_dispatch/middleware/show_exceptions.rb:30:in `call'
  from rails/rack/logger.rb:38:in `call_app'
  from rails/rack/logger.rb:20:in `block in call'
  from active_support/tagged_logging.rb:68:in `block in tagged'
  from active_support/tagged_logging.rb:26:in `tagged'
  from active_support/tagged_logging.rb:68:in `tagged'
  from rails/rack/logger.rb:20:in `call'
  from gitlab/request_context.rb:18:in `call'
  from request_store/middleware.rb:9:in `call'
  from action_dispatch/middleware/request_id.rb:21:in `call'
  from rack/methodoverride.rb:22:in `call'
  from rack/runtime.rb:18:in `call'
  from rack/lock.rb:17:in `call'
  from rack/sendfile.rb:113:in `call'
  from gitlab/metrics/requests_rack_middleware.rb:27:in `call'
  from raven/integrations/rack.rb:51:in `call'
  from rails/engine.rb:518:in `call'
  from rails/application.rb:165:in `call'
  from rails/railtie.rb:194:in `public_send'
  from rails/railtie.rb:194:in `method_missing'
  from gitlab/middleware/release_env.rb:10:in `call'
  from rack/urlmap.rb:66:in `block in call'
  from rack/urlmap.rb:50:in `each'
  from rack/urlmap.rb:50:in `call'
  from unicorn/http_server.rb:562:in `process_client'
  from unicorn/worker_killer.rb:52:in `process_client'
  from unicorn/http_server.rb:658:in `worker_loop'
  from unicorn/http_server.rb:508:in `spawn_missing_workers'
  from unicorn/http_server.rb:519:in `maintain_worker_count'
  from unicorn/http_server.rb:283:in `join'
  from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/unicorn-5.1.0/bin/unicorn:126:in `<top (required)>'
  from /opt/gitlab/embedded/bin/unicorn:23:in `load'
  from /opt/gitlab/embedded/bin/unicorn:23:in `<top (required)>'
  from bundler/cli/exec.rb:74:in `load'
  from bundler/cli/exec.rb:74:in `kernel_load'
  from bundler/cli/exec.rb:28:in `run'
  from bundler/cli.rb:424:in `exec'
  from bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  from bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
  from bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
  from bundler/cli.rb:27:in `dispatch'
  from bundler/vendor/thor/lib/thor/base.rb:466:in `start'
  from bundler/cli.rb:18:in `start'
  from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/bundler-1.16.2/exe/bundle:30:in `block in <top (required)>'
  from bundler/friendly_errors.rb:124:in `with_friendly_errors'
  from /opt/gitlab/embedded/lib/ruby/gems/2.4.0/gems/bundler-1.16.2/exe/bundle:22:in `<top (required)>'
  from /opt/gitlab/embedded/bin/bundle:23:in `load'
  from /opt/gitlab/embedded/bin/bundle:23:in `<main>'

Output of checks

Results of GitLab environment info

Expand for output related to GitLab environment info

GitLab information Version: 11.0.0 Revision: b84bfb5 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql

GitLab Shell Version: 7.1.4 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git
Edited by 🤖 GitLab Bot 🤖