{"record":{"id":"4bfc74b4344313fa","repo":"instructure/canvas-lms","slug":"improper-status-status-for-section-section-id-in-course","errorCode":null,"errorMessage":"Improper status \"#{status}\" for section #{section_id} in course #{course_id}","messagePattern":"Improper status \"#(.+?)\" for section #(.+?) in course #(.+?)","errorType":"validation","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/section_importer.rb","lineNumber":84,"sourceCode":"        :roll_back_data\n      )\n\n      def initialize(batch, root_account, logger)\n        @batch = batch\n        @root_account = root_account\n        @logger = logger\n        @success_count = 0\n        @sections_to_update_sis_batch_ids = []\n        @roll_back_data = []\n        @course_ids_to_update_associations = Set.new\n        @deleted_section_ids = Set.new\n      end\n\n      def add_section(section_id, course_id, name, status, start_date = nil, end_date = nil, integration_id = nil)\n        raise ImportError, \"No section_id given for a section in course #{course_id}\" if section_id.blank?\n        raise ImportError, \"No course_id given for a section #{section_id}\" if course_id.blank?\n        raise ImportError, \"No name given for section #{section_id} in course #{course_id}\" if name.blank? && status =~ /\\Aactive/i\n        raise ImportError, \"Improper status \\\"#{status}\\\" for section #{section_id} in course #{course_id}\" unless /\\Aactive|\\Adeleted/i.match?(status)\n        return if @batch.skip_deletes? && status =~ /deleted/i\n\n        course = @root_account.all_courses.find_by(sis_source_id: course_id)\n        raise ImportError, \"Section #{section_id} references course #{course_id} which doesn't exist\" unless course\n\n        section = @root_account.course_sections.find_by(sis_source_id: section_id)\n        section ||= course.course_sections.where(sis_source_id: section_id).first_or_initialize\n        section.root_account = @root_account\n        # this is an easy way to load up the cache with data we already have\n        section.course = course if course.id == section.course_id\n\n        # only update the name on new records, and ones that haven't been changed since the last sis import\n        raise ImportError, \"No name given for section #{section_id} in course #{course_id}\" if name.blank? && section.new_record?\n\n        section.name = name if section.new_record? || (!section.stuck_sis_fields.include?(:name) && name.present?)\n\n        # update the course id if necessary\n        if section.course_id != course.id","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/section_importer.rb#L66-L102","documentation":"Validation guard in SectionImporter::Work#add_section raised when the status argument is not one of the recognized workflow states (active/deleted etc.). The CSV supplied a status string the importer cannot act on, so the row is rejected as malformed.","triggerScenarios":"Thrown at lib/sis/section_importer.rb:84 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported status (active, deleted, completed) in the sections CSV","Fix and re-run the batch"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}