instructure/canvas-lms · error · ImportError

No long_name given for abstract course #

Error message

No long_name given for abstract course #{abstract_course_id}

What it means

add_abstract_course requires a non-blank long_name (the display course name). A course without a human-readable name is rejected with ImportError identifying the abstract_course_id. This completes the trio of required-field validations (id, short_name, long_name) performed before any persistence.

Solutions

  1. Populate long_name in the SIS data for the named course.
  2. Fix the column mapping in the export/parsing step.
  3. Default long_name from short_name (or vice versa) in your wrapper when blank.

Example fix

// before
importer.add_abstract_course('C1', 'CS101', '', 'active')
// after
long = row['long_name'].presence || row['short_name']
importer.add_abstract_course('C1', 'CS101', long, 'active')
Defensive patterns

Strategy: validation

Validate before calling

# Ruby
raise 'blank long_name' if row['long_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

When it happens

Trigger: Calling add_abstract_course(id, short_name, nil/'', status) — a SIS courses.csv row with an empty long_name column (lib/sis/abstract_course_importer.rb:51).

Common situations: Source system rows lacking a display name; extract scripts mapping the wrong column to long_name; partially filled migration spreadsheets.

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/eff31a790676e213. Report an issue: GitHub.

Appendix: source

Thrown at lib/sis/abstract_course_importer.rb:51

      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 changed
        # since the last sis import

View on GitHub (pinned to 1c9f0bb801)