instructure/canvas-lms · error · ImportError
No short_name given for abstract course #
Error message
No short_name given for abstract course #{abstract_course_id} What it means
add_abstract_course requires a non-blank short_name (the course code) for every abstract course. Without it the course cannot be created meaningfully in Canvas, so the importer raises ImportError naming the offending abstract_course_id. It is a per-row input validation, second only to the id check.
Solutions
- Populate short_name in the SIS data for the named course.
- Correct the CSV column mapping so short_name maps to the right source field.
- Provide a fallback short_name in your importer wrapper when the source value is blank.
Example fix
// before
importer.add_abstract_course('C1', nil, 'Long Name', 'active')
// after
short = row['short_name'].presence || row['course_id']
importer.add_abstract_course('C1', short, 'Long Name', 'active') Defensive patterns
Strategy: validation
Validate before calling
# Ruby raise 'blank short_name' if row['short_name'].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 << "Abstract course #{id}: #{e.message}"
end Prevention
- Require short_name in the SIS source and reject blank values upstream.
- Apply .presence fallbacks deliberately, not silently.
- Re-verify column order after source-system updates.
When it happens
Trigger: Calling add_abstract_course(id, nil/'', long_name, status) — e.g. a SIS courses.csv row with a blank short_name column (lib/sis/abstract_course_importer.rb:50).
Common situations: SIS exports with missing course code column values; column-order assumptions breaking after source system updates; template files with unfilled short_name cells.
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 abstract_course_id given for an abstract course
- No long_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/2d69da7f579accaa.
Report an issue: GitHub.
Appendix: source
Thrown at lib/sis/abstract_course_importer.rb:50
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
# only update the name/short_name on new records, and ones that haven't been changedView on GitHub (pinned to 1c9f0bb801)