instructure/canvas-lms · error · Canvas::Migration::Error
Not importing academic benchmark data because no user id set
Error message
Not importing academic benchmark data because no user id set
What it means
Academic Benchmark migrations must attribute imports to a real user id stored in the `academic_benchmark_migration_user_id` setting. ensure_user_id_set raises Canvas::Migration::Error when this setting is absent/blank, since imports cannot proceed without a valid owning user.
Solutions
- Set the setting: `Setting.set('academic_benchmark_migration_user_id', <existing active user id>)` on the relevant shard/root account
- Pick an admin user as the migration user and persist their id
- Re-create the setting if it was lost during environment migration
- Check `Setting.get('academic_benchmark_migration_user_id', nil)` in console before running imports
Example fix
// console
# before
Setting.get('academic_benchmark_migration_user_id', nil) # => nil
// after
admin = Account.site_admin.admin_users.first
Setting.set('academic_benchmark_migration_user_id', admin.id) Defensive patterns
Strategy: validation
Validate before calling
uid = Setting.get('academic_benchmark_migration_user_id', nil)
raise 'migration user id not set' unless uid.present? Try / catch
begin
AcademicBenchmark.import(...)
rescue Canvas::Migration::Error => e
raise unless e.message.include?('no user id set')
Rails.logger.error('Seed academic_benchmark_migration_user_id')
end Prevention
- Seed the setting on every shard at provisioning
- Point it at a durable admin/service account
- Re-verify after user cleanup scripts
When it happens
Trigger: Enqueuing or running an AB content migration when the root account Setting `academic_benchmark_migration_user_id` is unset or empty.
Common situations: Fresh installs or new shards where the setting was never seeded; the configured migration user was deleted and the setting cleared; multi-tenant setups where only some accounts have the setting.
Understand the failure class
Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.
Related errors
- You must specify either an Authority or a Publication to…
- Cannot validate existence for resource type: #
- Couldn't convert QTI 1.2 to 2.1, see error log: #
- course hasn't been converted
- Course not found
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/e07dff7b3db6607f.
Report an issue: GitHub.
Appendix: source
Thrown at gems/plugins/academic_benchmark/lib/academic_benchmark.rb:212
end
end
def self.ensure_partner_key
unless AcademicBenchmark.config[:partner_key].present?
"Partner key is not set"
end
end
def self.authorized?
check_for_import_rights(
user: ensure_real_user(user_id: ensure_user_id_set)
)
end
def self.ensure_user_id_set
uid = Setting.get("academic_benchmark_migration_user_id", nil)
unless uid.present?
raise Canvas::Migration::Error,
"Not importing academic benchmark data because no user id set"
end
uid
end
def self.ensure_real_user(user_id:)
u = User.find_by(id: user_id)
unless u
raise Canvas::Migration::Error,
"Not importing academic benchmark data because no user found matching id '#{user_id}'"
end
u
end
def self.check_for_import_rights(user:)
unless Account.site_admin.grants_right?(user, :manage_global_outcomes)
raise Canvas::Migration::Error,
"Not importing academic benchmark data because user with ID " \View on GitHub (pinned to 1c9f0bb801)