{"record":{"id":"23fea41bc1d40124","repo":"instructure/canvas-lms","slug":"invalid-date-override-enrollment-type","errorCode":null,"errorMessage":"Invalid date_override_enrollment_type","messagePattern":"Invalid date_override_enrollment_type","errorType":"validation","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"lib/sis/term_importer.rb","lineNumber":58,"sourceCode":"        @root_account = root_account\n        @roll_back_data = []\n        @logger = logger\n        @success_count = 0\n      end\n\n      def add_term(term_id, name, status, start_date = nil, end_date = nil, integration_id = nil, date_override_enrollment_type = nil)\n        raise ImportError, \"No term_id given for a term\" if term_id.blank?\n        raise ImportError, \"Improper status \\\"#{status}\\\" for term #{term_id}\" unless /\\Aactive|\\Adeleted/i.match?(status)\n        return if @batch.skip_deletes? && status =~ /deleted/i\n\n        term = @root_account.enrollment_terms.where(sis_source_id: term_id).first_or_initialize\n        term.sis_batch_id = @batch.id\n\n        if date_override_enrollment_type\n          # only configure the date override if this row is present\n          raise ImportError, \"Cannot set date override on non-existent term\" if term.new_record?\n          unless %w[StudentEnrollment TeacherEnrollment TaEnrollment DesignerEnrollment].include?(date_override_enrollment_type)\n            raise ImportError, \"Invalid date_override_enrollment_type\"\n          end\n\n          date_override = term.enrollment_dates_overrides.where(enrollment_type: date_override_enrollment_type).order(:id).first\n          unless date_override&.stuck_sis_fields&.intersect?(%i[start_at end_at])\n            case status\n            when /active/i\n              date_override ||= term.enrollment_dates_overrides.build(context: @root_account, enrollment_type: date_override_enrollment_type)\n              date_override.update!(start_at: start_date, end_at: end_date)\n            when /deleted/i\n              term.enrollment_dates_overrides.where(enrollment_type: date_override_enrollment_type).destroy_all\n            end\n          end\n        else\n          raise ImportError, \"No name given for term #{term_id}\" if name.blank?\n\n          # only update the name on new records, and ones that haven't been\n          # changed since the last sis import\n          if term.new_record? || !term.stuck_sis_fields.include?(:name)","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/lib/sis/term_importer.rb#L40-L76","documentation":"Validation guard in TermImporter::Work#add_term raised when the optional date_override_enrollment_type argument is present but not one of StudentEnrollment, TeacherEnrollment, TaEnrollment, or DesignerEnrollment. The date-override row targets an unsupported enrollment type, so the import refuses to configure the override.","triggerScenarios":"Thrown at lib/sis/term_importer.rb:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the supported enrollment types for the override column","Fix the CSV 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"}