Exception: Invalid single-table inheritance type: User is not a subclass of Namespace

I run the Gitlab Omnibus docker container. The other day I restarted it and moved up to the latest version. ( 14.3.6-ce.0, i think) Now I can’t login and I get errors “Exception: Invalid single-table inheritance type: User is not a subclass of Namespace”. Doing some searching, I found it is related to the database but, I don’t understand what the problem might be. The posts that I saw related to the ghost user and this is for normal users or the root user. I’m not real sure where go with this. Any suggestions for what I could try would be greatly appreciated.

I am also getting the same error. Were you able to resolve this?

After upgrading from 14.0.0 -> 14.0.12 -> 14.6.2, I upgraded to the latest docker tag. But latest docker tag was not pulled before upgrade, and was still pointing to 14.0.0 causing the error.

Having the same issue. This prevents from log in. Is there a solution?

I am facing the same issue.
Can someone help?

Is there no one in Gitlab, who can help on this?
No one from Gitlab is even replying here.
I urge Gitlab people to help out, please please.

@yadaom Let me reset your expectations a little bit. This is a community forum, where people help out from the good of their heart for free, and when they actually have some spare time. It is not a guarantee to a solution and fix to your problem - that is what official Gitlab support is for, and that is something you normally pay for. If you don’t pay for it, then you can have zero expectations for whether your problem is fixed or not, or even if it will get a reply.

There are already plenty of posts with problems upgrading Gitlab on this forum from 14.x to whatever later version and plenty of recommendations in them. You should go back to basics and restore your system from the backup made prior to your upgrade. This then means your next steps are:

  1. Install Gitlab 14.0.x (has to be same version as last backup made before failed upgrade).
  2. Follow Gitlab documentation on how to restore your Gitlab installation, this means ensuring that you have gitlab.rb and gitlab-secrets.json in the /etc/gitlab directory. Back up and restore GitLab | GitLab
  3. Once you have restored your Gitlab installation and it is working properly, then make sure this time you follow the Gitlab upgrade documentation properly, ensuring that you follow the upgrade path as well as ensuring background migrations have finished before attempting to do the next upgrade on the upgrade path. Everything I’ve mentioned about upgrades you can find here: Upgrading GitLab | GitLab

Rolling back doesn’t always work, as it seems you have found out, therefore it means restoring your server to when it was last working and starting again.

That’s about all I can suggest to you. I would also suggest if you do try the upgrade again, that you do like some of the other posts on this forum suggest which would be:

  1. Upgrade from 14.0.x to 14.1.0.
  2. Upgrade from 14.1.0 to 14.2.0.
  3. Upgrade from 14.2.0 to 14.3.0.

And so on until you get to the latest 14.10.x release. At which point, you can then think about upgrading to Gitlab 15.x. Please do not start the next upgrade until all background migrations have finished.

Thanks for resetting my expectations. :slightly_smiling_face:
I am desperately trying to fix this issue and not getting any help.
The problem has started without even doing a upgrade.
I am trying todo the step by step upgrade now.
But no luck till now.
Seems like, now need to reset the DB and start again.

Thanks for your reply.

Hmm strange, you replied to the post saying you had the same problem as the person who had posted - only that they had the problem occur because of an upgrade. So this confuses us.

If you didn’t do anything to your installation, then it shouldn’t have failed like that. In the mean time you could try:

gitlab-ctl reconfigure
gitlab-ctl restart

and see if that helps any. Also take a look at the migration commands to check the status and potentially run ones that failed: Maintenance Rake tasks | GitLab

I am really thankful of your time.

  "severity": "WARN",
  "time": "2022-05-31T16:01:08.665Z",
  "queue": "cronjob:database_batched_background_migration",
  "args": [],
  "class": "Database::BatchedBackgroundMigrationWorker",
  "retry": 0,
  "version": 0,
  "queue_namespace": "cronjob",
  "jid": "10140c92e38ffe2094d28439",
  "created_at": "2022-05-31T16:01:08.530Z",
  "meta.caller_id": "Cronjob",
  "meta.feature_category": "database",
  "correlation_id": "8d142d245bdf1b043a445db0b832f599",
  "idempotency_key": "resque:gitlab:duplicate:cronjob:database_batched_background_migration:592d9619e1997b640b70ce6a22f6713bc7793bb7a4e342b7380d90b691fcd6ae",
  "enqueued_at": "2022-05-31T16:01:08.531Z",
  "job_size_bytes": 2,
  "pid": 547,
  "message": "Database::BatchedBackgroundMigrationWorker JID-10140c92e38ffe2094d28439: fail: 0.090374 sec",
  "job_status": "fail",
  "scheduling_latency_s": 0.001234,
  "redis_calls": 5,
  "redis_duration_s": 0.079279,
  "redis_read_bytes": 5,
  "redis_write_bytes": 803,
  "redis_cache_calls": 2,
  "redis_cache_duration_s": 0.001581,
  "redis_cache_read_bytes": 2,
  "redis_cache_write_bytes": 242,
  "redis_queues_calls": 1,
  "redis_queues_duration_s": 0.000498,
  "redis_queues_read_bytes": 1,
  "redis_queues_write_bytes": 151,
  "redis_shared_state_calls": 2,
  "redis_shared_state_duration_s": 0.0772,
  "redis_shared_state_read_bytes": 2,
  "redis_shared_state_write_bytes": 410,
  "db_count": 4,
  "db_write_count": 0,
  "db_cached_count": 0,
  "cpu_s": 0.004955,
  "mem_objects": 2592,
  "mem_bytes": 292240,
  "mem_mallocs": 490,
  "mem_total_bytes": 395920,
  "duration_s": 0.090374,
  "completed_at": "2022-05-31T16:01:08.623Z",
  "error_message": "uninitialized constant Gitlab::BackgroundMigration::BatchingStrategies::BackfillIssueWorkItemTypeBatchingStrategy\nDid you mean?  Gitlab::BackgroundMigration::BackfillIntegrationsTypeNew",
  "error_class": "NameError",
  "error_backtrace": [
    "lib/gitlab/database/background_migration/batched_migration.rb:80:in `batch_class'",
    "lib/gitlab/database/background_migration/batched_migration_runner.rb:91:in `find_next_batch_range'",
    "lib/gitlab/database/background_migration/batched_migration_runner.rb:83:in `find_or_create_next_batched_job'",
    "lib/gitlab/database/background_migration/batched_migration_runner.rb:28:in `run_migration_job'",
    "app/workers/database/batched_background_migration_worker.rb:41:in `run_active_migration'",
    "app/workers/database/batched_background_migration_worker.rb:30:in `block in perform'",
    "app/workers/database/batched_background_migration_worker.rb:48:in `with_exclusive_lease'",
    "app/workers/database/batched_background_migration_worker.rb:22:in `perform'",
    "lib/gitlab/sidekiq_middleware/duplicate_jobs/strategies/until_executing.rb:16:in `perform'",
    "lib/gitlab/sidekiq_middleware/duplicate_jobs/duplicate_job.rb:41:in `perform'",
    "lib/gitlab/sidekiq_middleware/duplicate_jobs/server.rb:8:in `call'",
    "lib/gitlab/application_context.rb:74:in `block in use'",
    "lib/gitlab/application_context.rb:74:in `use'",
    "lib/gitlab/sidekiq_middleware/worker_context.rb:11: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:69:in `block in call'",
    "lib/gitlab/sidekiq_middleware/server_metrics.rb:92:in `block in instrument'",
    "lib/gitlab/metrics/background_transaction.rb:30:in `run'",
    "lib/gitlab/sidekiq_middleware/server_metrics.rb:92:in `instrument'",
    "lib/gitlab/sidekiq_middleware/server_metrics.rb:68: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'"
  "db_duration_s": 0.004756

I just noticed the above warning in the logs.
Any idea if this is related to the error, I am getting?