instructure/canvas-lms · error · ImportError
Invalid date_override_enrollment_type
Error message
Invalid date_override_enrollment_type
What it means
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.
Solutions
- Use one of the supported enrollment types for the override column
- Fix the CSV and re-run the batch
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at lib/sis/term_importer.rb:58 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/23fea41bc1d40124.
Report an issue: GitHub.
Appendix: source
Thrown at lib/sis/term_importer.rb:58
@root_account = root_account
@roll_back_data = []
@logger = logger
@success_count = 0
end
def add_term(term_id, name, status, start_date = nil, end_date = nil, integration_id = nil, date_override_enrollment_type = nil)
raise ImportError, "No term_id given for a term" if term_id.blank?
raise ImportError, "Improper status \"#{status}\" for term #{term_id}" unless /\Aactive|\Adeleted/i.match?(status)
return if @batch.skip_deletes? && status =~ /deleted/i
term = @root_account.enrollment_terms.where(sis_source_id: term_id).first_or_initialize
term.sis_batch_id = @batch.id
if date_override_enrollment_type
# only configure the date override if this row is present
raise ImportError, "Cannot set date override on non-existent term" if term.new_record?
unless %w[StudentEnrollment TeacherEnrollment TaEnrollment DesignerEnrollment].include?(date_override_enrollment_type)
raise ImportError, "Invalid date_override_enrollment_type"
end
date_override = term.enrollment_dates_overrides.where(enrollment_type: date_override_enrollment_type).order(:id).first
unless date_override&.stuck_sis_fields&.intersect?(%i[start_at end_at])
case status
when /active/i
date_override ||= term.enrollment_dates_overrides.build(context: @root_account, enrollment_type: date_override_enrollment_type)
date_override.update!(start_at: start_date, end_at: end_date)
when /deleted/i
term.enrollment_dates_overrides.where(enrollment_type: date_override_enrollment_type).destroy_all
end
end
else
raise ImportError, "No name given for term #{term_id}" if name.blank?
# only update the name on new records, and ones that haven't been
# changed since the last sis import
if term.new_record? || !term.stuck_sis_fields.include?(:name)View on GitHub (pinned to 1c9f0bb801)