GitLab Migration - NoMethodError undefined method `start_with?' for nil:NilClass
The problem
I found this error while playing with GitLab Group Migration on my GDK. It is reproducible. It seems to happen every time we import a group with projects. Although, after awhile the migration succeeds and the projects are properly migrated. Still, we should try to figure out what's happening and avoid this exception.
Exception logs:
> tail -f -n10 log/exceptions_json.log | jq .
{
"severity": "ERROR",
"time": "2021-10-22T19:29:44.763Z",
"correlation_id": "ac86c3897b5619369c3491e45e1dd4ce",
"exception.class": "NoMethodError",
"exception.message": "undefined method `start_with?' for nil:NilClass",
"exception.backtrace": [
"lib/gitlab/git/repository.rb:829:in `import_repository'",
"app/services/projects/import_service.rb:98:in `import_repository'",
"app/services/projects/import_service.rb:81:in `add_repository_to_project'",
"app/services/projects/import_service.rb:21:in `execute'",
"app/services/concerns/measurable.rb:35:in `execute'",
"app/workers/repository_import_worker.rb:28:in `perform'",
"ee/app/workers/ee/repository_import_worker.rb:9:in `perform'",
"lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing.rb:16:in `perform'",
"lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb:57:in `perform'",
"lib/gitlab/sidekiq_middleware/duplicate_jobs/server.rb:8:in `call'",
"lib/gitlab/sidekiq_middleware/worker_context.rb:9:in `wrap_in_optional_context'",
"lib/gitlab/sidekiq_middleware/worker_context/server.rb:17:in `block in call'",
"lib/gitlab/application_context.rb:74:in `block in use'",
"lib/gitlab/application_context.rb:74:in `use'",
"lib/gitlab/application_context.rb:27:in `with_context'",
"lib/gitlab/sidekiq_middleware/worker_context/server.rb:15:in `call'",
"lib/gitlab/sidekiq_status/server_middleware.rb:7:in `call'",
"lib/gitlab/sidekiq_versioning/middleware.rb:9:in `call'",
"lib/gitlab/sidekiq_middleware/admin_mode/server.rb:14:in `call'",
"lib/gitlab/sidekiq_middleware/instrumentation_logger.rb:9:in `call'",
"lib/gitlab/sidekiq_middleware/batch_loader.rb:7:in `call'",
"lib/gitlab/sidekiq_middleware/extra_done_log_metadata.rb:7:in `call'",
"lib/gitlab/sidekiq_middleware/request_store_middleware.rb:10:in `block in call'",
"lib/gitlab/with_request_store.rb:17:in `enabling_request_store'",
"lib/gitlab/with_request_store.rb:10:in `with_request_store'",
"lib/gitlab/sidekiq_middleware/request_store_middleware.rb:9:in `call'",
"lib/gitlab/sidekiq_middleware/server_metrics.rb:66:in `block in call'",
"lib/gitlab/sidekiq_middleware/server_metrics.rb:89:in `block in instrument'",
"lib/gitlab/metrics/background_transaction.rb:33:in `run'",
"lib/gitlab/sidekiq_middleware/server_metrics.rb:89:in `instrument'",
"lib/gitlab/sidekiq_middleware/server_metrics.rb:65:in `call'",
"lib/gitlab/sidekiq_middleware/monitor.rb:8:in `block in call'",
"lib/gitlab/sidekiq_daemon/monitor.rb:49:in `within_job'",
"lib/gitlab/sidekiq_middleware/monitor.rb:7:in `call'",
"lib/gitlab/sidekiq_middleware/size_limiter/server.rb:13:in `call'",
"lib/gitlab/sidekiq_logging/structured_logger.rb:19:in `call'"
],
"user.username": "root",
"tags.program": "sidekiq",
"tags.locale": "en",
"tags.feature_category": "importers",
"tags.correlation_id": "ac86c3897b5619369c3491e45e1dd4ce",
"extra.sidekiq": {
"retry": false,
"queue": "repository_import",
"backtrace": 5,
"version": 0,
"dead": false,
"status_expiration": 86400,
"memory_killer_memory_growth_kb": 50,
"memory_killer_max_memory_growth_kb": 300000,
"class": "RepositoryImportWorker",
"args": [
"72"
],
"jid": "893a398e64a8a5447aa95787",
"created_at": 1634930960.0545769,
"meta.user": "root",
"meta.project": "Commit451/twitter-2/typeahead-js",
"meta.root_namespace": "Commit451",
"meta.caller_id": "BulkImports::PipelineWorker",
"meta.remote_ip": "172.16.123.1",
"meta.feature_category": "importers",
"meta.client_id": "user/1",
"correlation_id": "ac86c3897b5619369c3491e45e1dd4ce",
"worker_data_consistency": "always",
"idempotency_key": "resque:gitlab:duplicate:repository_import:cf53df505eed5f5bcb23eeb9eda589483e6d6681ff429c2cd9bf44813b61683d",
"size_limiter": "validated",
"enqueued_at": 1634930960.057909
},
"extra.import_type": "gitlab_project_migration",
"extra.project_id": 72,
"extra.source": "Projects::ImportService"
}
Edited by João Alexandre Cunha