{"record":{"id":"2d69da7f579accaa","repo":"instructure/canvas-lms","slug":"no-short-name-given-for-abstract-course-abstract-course-id","errorCode":null,"errorMessage":"No short_name given for abstract course #{abstract_course_id}","messagePattern":"No short_name given for abstract course #(.+?)","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/abstract_course_importer.rb","lineNumber":50,"sourceCode":"\n      importer.success_count\n    end\n\n    class Work\n      attr_accessor :success_count, :abstract_courses_to_update_sis_batch_id, :roll_back_data\n\n      def initialize(batch, root_account, logger)\n        @batch = batch\n        @root_account = root_account\n        @abstract_courses_to_update_sis_batch_id = []\n        @roll_back_data = []\n        @logger = logger\n        @success_count = 0\n      end\n\n      def add_abstract_course(abstract_course_id, short_name, long_name, status, term_id = nil, account_id = nil, fallback_account_id = nil)\n        raise ImportError, \"No abstract_course_id given for an abstract course\" if abstract_course_id.blank?\n        raise ImportError, \"No short_name given for abstract course #{abstract_course_id}\" if short_name.blank?\n        raise ImportError, \"No long_name given for abstract course #{abstract_course_id}\" if long_name.blank?\n        raise ImportError, \"Improper status \\\"#{status}\\\" for abstract course #{abstract_course_id}\" unless /\\Aactive|\\Adeleted/i.match?(status)\n        return if @batch.skip_deletes? && status =~ /deleted/i\n\n        course = AbstractCourse.find_by(root_account_id: @root_account, sis_source_id: abstract_course_id)\n        course ||= AbstractCourse.new\n        unless course.stuck_sis_fields.include?(:enrollment_term_id)\n          course.enrollment_term = @root_account.enrollment_terms.find_by(sis_source_id: term_id) || @root_account.default_enrollment_term\n        end\n        course.root_account = @root_account\n\n        account = nil\n        account = @root_account.all_accounts.find_by(sis_source_id: account_id) if account_id.present?\n        account ||= @root_account.all_accounts.find_by(sis_source_id: fallback_account_id) if fallback_account_id.present?\n        course.account = account if account\n        course.account ||= @root_account\n\n        # only update the name/short_name on new records, and ones that haven't been changed","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/abstract_course_importer.rb#L32-L68","documentation":"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.","triggerScenarios":"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).","commonSituations":"SIS exports with missing course code column values; column-order assumptions breaking after source system updates; template files with unfilled short_name cells.","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."],"exampleFix":"// before\nimporter.add_abstract_course('C1', nil, 'Long Name', 'active')\n// after\nshort = row['short_name'].presence || row['course_id']\nimporter.add_abstract_course('C1', short, 'Long Name', 'active')","handlingStrategy":"validation","validationCode":"# Ruby\nraise 'blank short_name' if row['short_name'].to_s.strip.empty?\nimporter.add_abstract_course(row['course_id'], row['short_name'], row['long_name'], row['status'])","typeGuard":null,"tryCatchPattern":"begin\n  importer.add_abstract_course(id, short, long, status)\nrescue SIS::AbstractCourseImporter::ImportError => e\n  warnings << \"Abstract course #{id}: #{e.message}\"\nend","preventionTips":["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."],"tags":["sis","import","validation","missing-field"],"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"}