{"record":{"id":"5a15f8a263f49cac","repo":"instructure/canvas-lms","slug":"student-with-id-student-id-not-found","errorCode":null,"errorMessage":"Student with ID %{student_id} not found.","messagePattern":"Student with ID %(.+?) not found\\.","errorType":"validation","errorClass":"DataFormatError","httpStatus":null,"severity":"error","filePath":"app/models/rubric_assessment_import.rb","lineNumber":127,"sourceCode":"  end\n\n  def process_assessments\n    error_data = []\n\n    rubric_association = assignment.rubric_association\n    rubric = rubric_association.rubric\n    assessments_by_student = RubricAssessmentCSVImporter.new(attachment, rubric, rubric_association).parse\n    raise DataFormatError, I18n.t(\"The file is empty or does not contain valid assessment data.\") if assessments_by_student.empty?\n\n    total_assessments = assessments_by_student.keys.count\n\n    students = User.where(id: assessments_by_student.keys).index_by(&:id)\n    student_submissions = assignment.submissions.where(user_id: students.keys).index_by(&:user_id)\n\n    assessments_by_student.each_with_index do |(student_id, assessment), student_index|\n      student_to_assess = students[student_id.to_i]\n\n      raise DataFormatError, I18n.t(\"Student with ID %{student_id} not found.\", student_id:) unless student_to_assess\n      raise UnauthorizedError unless rubric_association.user_can_assess_for?(assessor: user, assessee: student_to_assess)\n\n      assessment = assessment.to_h do |criterion|\n        [:\"criterion_#{criterion[:id]}\",\n         {\n           points: criterion[:points],\n           comments: criterion[:comments],\n           description: criterion[:rating]\n         }]\n      end\n      assessment[:assessment_type] = \"grading\"\n\n      rubric_association.assess(\n        assessor: user,\n        user: student_to_assess,\n        artifact: student_submissions[student_id.to_i],\n        assessment:,\n        graded_anonymously: false,","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/models/rubric_assessment_import.rb#L109-L145","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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)"],"exampleFix":"// before\nstudent_id,points\n455001,10   # ID from a different course\n// after\nstudent_id,points\n<current course student canvas_id>,10","handlingStrategy":"validation","validationCode":"course_user_ids = course.students.pluck(:id)\nbad_ids = csv_student_ids.map(&:to_i) - course_user_ids\nraise \"unknown student IDs: #{bad_ids.join(', ')}\" if bad_ids.any?","typeGuard":null,"tryCatchPattern":"begin\n  import.process\nrescue DataFormatError => e\n  flash[:error] = e.message # tells which student_id was not found\nend","preventionTips":["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"],"tags":["csv","import","rubrics","record-not-found"],"backgroundTag":"record-not-found","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"}