{"record":{"id":"cb01e815c85f6c7c","repo":"instructure/canvas-lms","slug":"you-must-specify-either-an-authority-or-a-publication-to","errorCode":null,"errorMessage":"You must specify either an Authority or a Publication to import (both were nil)","messagePattern":"You must specify either an Authority or a Publication to import \\(both were nil\\)","errorType":"exception","errorClass":"Canvas::Migration::Error","httpStatus":null,"severity":"error","filePath":"gems/plugins/academic_benchmark/lib/academic_benchmark.rb","lineNumber":176,"sourceCode":"    cm.user = user\n    cm.root_account_id = 0\n    cm.save!\n    [cm, cm.export_content]\n  end\n\n  def self.api_handle\n    # create a new api connection.  Note that this does not actually\n    # make a request to the API\n    AcademicBenchmarks::Api::Handle.new(partner_id: config[:partner_id], partner_key: config[:partner_key])\n  end\n\n  def self.auth?(guid)\n    api_handle.standards.authorities.map(&:guid).include?(guid)\n  end\n\n  def self.check_args(authority, publication)\n    if authority.nil? && publication.nil?\n      raise Canvas::Migration::Error,\n            \"You must specify either an Authority or a Publication to import (both were nil)\"\n    end\n  end\n\n  def self.ensure_ab_credentials\n    err = nil\n    err ||= ensure_partner_id\n    err ||= ensure_partner_key\n    if err\n      raise Canvas::Migration::Error,\n            \"Not importing academic benchmark data because the Academic Benchmarks #{err}\"\n    end\n  end\n\n  def self.ensure_partner_id\n    unless AcademicBenchmark.config[:partner_id].present?\n      \"Partner ID is not set\"\n    end","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/gems/plugins/academic_benchmark/lib/academic_benchmark.rb#L158-L194","documentation":"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.","triggerScenarios":"Launching an Academic Benchmark import (migration tool or API) without supplying `authority` or `publication` parameters; a migration form/submitter dropping both fields.","commonSituations":"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.","solutions":["Pass either an authority guid or a publication guid to the migration","Fix the calling form/API so the selected guid is included in the migration settings","Skip Academic Benchmark import if the migration does not target AB content","Validate inputs before creating the migration to give a friendlier error"],"exampleFix":"// before\nAcademicBenchmark.import_migration(mig) # no authority/publication set\n// after\nmig.set_default_settings(authority: 'ABC123') # or publication: guid\nAcademicBenchmark.import_migration(mig)","handlingStrategy":"validation","validationCode":"raise 'authority or publication required' if authority.nil? && publication.nil?","typeGuard":null,"tryCatchPattern":"begin\n  AcademicBenchmark.import(...)\nrescue Canvas::Migration::Error => e\n  raise unless e.message.include?('Authority or a Publication')\n  # show friendly input error\nend","preventionTips":["Validate migration params before enqueueing","Always forward authority/publication from the form","Skip AB import when not targeting AB content"],"tags":["academic-benchmark","outcomes","argument-validation","migration"],"backgroundTag":"missing-required-argument","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}