instructure/canvas-lms · error · DataFormatError
Student with ID not found.
Error message
Student with ID %{student_id} not found. What it means
RubricAssessmentImport#process_assessments raises DataFormatError when a student ID present in the uploaded assessments CSV does not match any User in the course (students lookup by ID finds nothing). It may also follow an UnauthorizedError for the assessor, but this specific error is purely the missing student record.
Solutions
- Re-export the student roster from the current course and use the exact Canvas user IDs
- Verify each student ID in the CSV is currently enrolled in the course
- Check the file wasn't exported from a different Canvas environment (test/beta/prod) or prior term
- Fix IDs damaged by spreadsheet auto-formatting (open the CSV in a text editor to verify)
Example fix
// before student_id,points 455001,10 # ID from a different course // after student_id,points <current course student canvas_id>,10
Defensive patterns
Strategy: validation
Validate before calling
course_user_ids = course.students.pluck(:id)
bad_ids = csv_student_ids.map(&:to_i) - course_user_ids
raise "unknown student IDs: #{bad_ids.join(', ')}" if bad_ids.any? Try / catch
begin import.process rescue DataFormatError => e flash[:error] = e.message # tells which student_id was not found end
Prevention
- Export the roster from the same course/term as the CSV upload
- Use Canvas user IDs, not SIS or login IDs, unless the template says so
- Avoid editing ID columns in Excel (auto-formatting can corrupt them)
- Re-export the roster if enrollments changed after generating the CSV
When it happens
Trigger: The CSV's student identifier column contains an ID not enrolled in the assignment's course — e.g. IDs from a different course/term, a deleted or concluded enrollment, a typo, or using SIS/login IDs instead of Canvas user IDs.
Common situations: Downloading the roster from a previous term or a different course; students dropped from the course after the CSV was generated; Excel stripping leading zeros or reformatting IDs; copying IDs from another Canvas instance (beta/test).
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Missing 'Rubric Name' in some rows.
- The file is empty or does not contain valid assessment data.
- The file is empty or does not contain valid rubric data.
- A cross-listing referenced a non-existent section #
- A student referenced a non-existent user #
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/5a15f8a263f49cac.
Report an issue: GitHub.
Appendix: source
Thrown at app/models/rubric_assessment_import.rb:127
end
def process_assessments
error_data = []
rubric_association = assignment.rubric_association
rubric = rubric_association.rubric
assessments_by_student = RubricAssessmentCSVImporter.new(attachment, rubric, rubric_association).parse
raise DataFormatError, I18n.t("The file is empty or does not contain valid assessment data.") if assessments_by_student.empty?
total_assessments = assessments_by_student.keys.count
students = User.where(id: assessments_by_student.keys).index_by(&:id)
student_submissions = assignment.submissions.where(user_id: students.keys).index_by(&:user_id)
assessments_by_student.each_with_index do |(student_id, assessment), student_index|
student_to_assess = students[student_id.to_i]
raise DataFormatError, I18n.t("Student with ID %{student_id} not found.", student_id:) unless student_to_assess
raise UnauthorizedError unless rubric_association.user_can_assess_for?(assessor: user, assessee: student_to_assess)
assessment = assessment.to_h do |criterion|
[:"criterion_#{criterion[:id]}",
{
points: criterion[:points],
comments: criterion[:comments],
description: criterion[:rating]
}]
end
assessment[:assessment_type] = "grading"
rubric_association.assess(
assessor: user,
user: student_to_assess,
artifact: student_submissions[student_id.to_i],
assessment:,
graded_anonymously: false,View on GitHub (pinned to 1c9f0bb801)