instructure/canvas-lms · error · ImportError
No abstract_course_id given for an abstract course
Error message
No abstract_course_id given for an abstract course
What it means
SIS::AbstractCourseImporter#add_abstract_course validates its inputs before touching the database. An abstract course row without an abstract_course_id (the SIS external identifier) cannot be keyed, so the importer raises ImportError immediately. This is a defensive check for malformed SIS CSV/data feed rows.
Solutions
- Fix the SIS data source so every abstract course row has a non-blank course_id.
- Check CSV parsing/column mapping — a shifted column can blank out course_id.
- Filter or report invalid rows upstream before invoking the importer.
Example fix
// before importer.add_abstract_course(nil, 'CS101', 'Intro CS', 'active') // after raise 'missing id' if row['course_id'].blank? importer.add_abstract_course(row['course_id'], 'CS101', 'Intro CS', 'active')
Defensive patterns
Strategy: validation
Validate before calling
# Ruby: caller-side guard before invoking the importer raise 'blank abstract_course_id' if row['course_id'].to_s.strip.empty? importer.add_abstract_course(row['course_id'], row['short_name'], row['long_name'], row['status'])
Try / catch
begin
importer.add_abstract_course(id, short, long, status)
rescue SIS::AbstractCourseImporter::ImportError => e
warnings << "Skipping abstract course: #{e.message}"
end Prevention
- Validate SIS CSV required columns (course_id, short_name, long_name, status) before import.
- Check column mappings whenever the source schema changes.
- Skip-and-log blank-id rows instead of feeding them to the importer.
When it happens
Trigger: Calling add_abstract_course(nil/'', ...) — e.g. a SIS courses.csv row missing the course_id column, or a custom importer invocation omitting the first argument (lib/sis/abstract_course_importer.rb:49).
Common situations: Malformed SIS export files with empty course_id cells; CSV column misalignment after schema changes; scripts building import rows that skip blank ids.
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
- No long_name given for abstract course #
- No short_name given for abstract course #
- No login_id given for user #
- No new_id or new_integration_id given for change_sis_id
- No old_id or old_integration_id given for change_sis_id
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/a38006d570cfe251.
Report an issue: GitHub.
Appendix: source
Thrown at lib/sis/abstract_course_importer.rb:49
SisBatchRollBackData.bulk_insert_roll_back_data(importer.roll_back_data)
importer.success_count
end
class Work
attr_accessor :success_count, :abstract_courses_to_update_sis_batch_id, :roll_back_data
def initialize(batch, root_account, logger)
@batch = batch
@root_account = root_account
@abstract_courses_to_update_sis_batch_id = []
@roll_back_data = []
@logger = logger
@success_count = 0
end
def add_abstract_course(abstract_course_id, short_name, long_name, status, term_id = nil, account_id = nil, fallback_account_id = nil)
raise ImportError, "No abstract_course_id given for an abstract course" if abstract_course_id.blank?
raise ImportError, "No short_name given for abstract course #{abstract_course_id}" if short_name.blank?
raise ImportError, "No long_name given for abstract course #{abstract_course_id}" if long_name.blank?
raise ImportError, "Improper status \"#{status}\" for abstract course #{abstract_course_id}" unless /\Aactive|\Adeleted/i.match?(status)
return if @batch.skip_deletes? && status =~ /deleted/i
course = AbstractCourse.find_by(root_account_id: @root_account, sis_source_id: abstract_course_id)
course ||= AbstractCourse.new
unless course.stuck_sis_fields.include?(:enrollment_term_id)
course.enrollment_term = @root_account.enrollment_terms.find_by(sis_source_id: term_id) || @root_account.default_enrollment_term
end
course.root_account = @root_account
account = nil
account = @root_account.all_accounts.find_by(sis_source_id: account_id) if account_id.present?
account ||= @root_account.all_accounts.find_by(sis_source_id: fallback_account_id) if fallback_account_id.present?
course.account = account if account
course.account ||= @root_account
View on GitHub (pinned to 1c9f0bb801)