instructure/canvas-lms · error · Canvas::Migration::Error

You must specify either an Authority or a Publication to…

Error message

You must specify either an Authority or a Publication to import (both were nil)

What it means

AcademicBenchmark content migration requires exactly one of an authority guid or a publication guid to know what standards data to import. check_args raises Canvas::Migration::Error when both are nil because there is nothing to import.

Solutions

  1. Pass either an authority guid or a publication guid to the migration
  2. Fix the calling form/API so the selected guid is included in the migration settings
  3. Skip Academic Benchmark import if the migration does not target AB content
  4. Validate inputs before creating the migration to give a friendlier error

Example fix

// before
AcademicBenchmark.import_migration(mig) # no authority/publication set
// after
mig.set_default_settings(authority: 'ABC123') # or publication: guid
AcademicBenchmark.import_migration(mig)
Defensive patterns

Strategy: validation

Validate before calling

raise 'authority or publication required' if authority.nil? && publication.nil?

Try / catch

begin
  AcademicBenchmark.import(...)
rescue Canvas::Migration::Error => e
  raise unless e.message.include?('Authority or a Publication')
  # show friendly input error
end

Prevention

When it happens

Trigger: Launching an Academic Benchmark import (migration tool or API) without supplying `authority` or `publication` parameters; a migration form/submitter dropping both fields.

Common situations: Custom migration scripts omitting params; UI/API regression where the selected authority/publication isn't forwarded; importing generic outcomes not tied to an AB authority.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15). Data as JSON: /api/errors/cb01e815c85f6c7c. Report an issue: GitHub.

Appendix: source

Thrown at gems/plugins/academic_benchmark/lib/academic_benchmark.rb:176

    cm.user = user
    cm.root_account_id = 0
    cm.save!
    [cm, cm.export_content]
  end

  def self.api_handle
    # create a new api connection.  Note that this does not actually
    # make a request to the API
    AcademicBenchmarks::Api::Handle.new(partner_id: config[:partner_id], partner_key: config[:partner_key])
  end

  def self.auth?(guid)
    api_handle.standards.authorities.map(&:guid).include?(guid)
  end

  def self.check_args(authority, publication)
    if authority.nil? && publication.nil?
      raise Canvas::Migration::Error,
            "You must specify either an Authority or a Publication to import (both were nil)"
    end
  end

  def self.ensure_ab_credentials
    err = nil
    err ||= ensure_partner_id
    err ||= ensure_partner_key
    if err
      raise Canvas::Migration::Error,
            "Not importing academic benchmark data because the Academic Benchmarks #{err}"
    end
  end

  def self.ensure_partner_id
    unless AcademicBenchmark.config[:partner_id].present?
      "Partner ID is not set"
    end

View on GitHub (pinned to 1c9f0bb801)