instructure/canvas-lms · error · ImportError

A term did not pass validation

Error message

A term did not pass validation (term: #{term_id} / #{name}, error: #{term.errors.full_messages.join(", ")})

What it means

Persistence failure in TermImporter::Work#add_term: the enrollment term record was built and populated but ActiveRecord save returned false (model-level validation failures such as invalid dates or missing name). The error aggregates term.errors.full_messages, and the term is not counted or rolled into batch data.

Solutions

  1. Read the embedded validation errors (e.g. bad dates) and fix the row
  2. Re-run the SIS batch after correction
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/sis/term_importer.rb:102 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/e26dcc7b2922804f. Report an issue: GitHub.

Appendix: source

Thrown at lib/sis/term_importer.rb:102

            term.workflow_state = "active"
          when /deleted/i
            term.workflow_state = "deleted"
          end
          unless term.stuck_sis_fields.intersect?([:start_at, :end_at])
            term.start_at = start_date
            term.end_at = end_date
          end
        end

        if term.save
          data = SisBatchRollBackData.build_data(sis_batch: @batch, context: term)
          @roll_back_data << data if data
          @success_count += 1
        else
          msg = "A term did not pass validation "
          msg += "(" + "term: #{term_id} / #{name}, error: "
          msg += term.errors.full_messages.join(", ") + ")"
          raise ImportError, msg
        end
      end
    end
  end
end

View on GitHub (pinned to 1c9f0bb801)