instructure/canvas-lms · error · DataFormatError
The file is empty or does not contain valid assessment data.
Error message
The file is empty or does not contain valid assessment data.
What it means
RubricAssessmentImport#process_assessments raises DataFormatError when the parsed CSV yields no assessments by student — meaning the uploaded attachment produced zero valid rows (empty file or content the RubricAssessmentCSVImporter could not interpret).
Solutions
- Download the provided assessment CSV template and populate it without changing header names
- Ensure the file is a real comma-separated CSV (re-save from the spreadsheet app as 'CSV UTF-8')
- Verify the file contains at least one data row with a valid student ID and scores
- Check that the student IDs in the file exist in the course (also avoids error 487)
Example fix
// before
import_file(my_export.xlsx)
// after
csv = File.read("assessments.csv") # headers: student_id, criterion_id, points, comments
csv += "12345,Criterion1,10,good work\n" if csv.lines.size <= 1 Defensive patterns
Strategy: validation
Validate before calling
csv = CSV.read(uploaded_path, headers: true) raise "file has no data rows" if csv.empty? raise "missing required headers" unless (csv.headers & REQUIRED_HEADERS) == REQUIRED_HEADERS
Try / catch
begin import.process rescue DataFormatError => e flash[:error] = e.message end
Prevention
- Always start from the provided CSV template
- Re-export as CSV UTF-8 from the spreadsheet app
- Preview the file in a text editor before uploading
- Verify the correct export (assessments vs rubrics) is uploaded
When it happens
Trigger: Uploading an empty CSV, a file with only headers, a wrong file type (e.g. xlsx saved with .csv extension but wrong encoding/content), or a CSV whose columns do not match the expected assessment format so the importer returns an empty hash.
Common situations: Users exporting from a spreadsheet but exporting the wrong sheet; CSV with wrong delimiter (semicolon vs comma); template columns renamed or reordered; uploading the rubric CSV instead of the assessments CSV.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Missing 'Rubric Name' in some rows.
- The file is empty or does not contain valid rubric data.
- Friendly description is too long (maximum is 255 characters)
- Invalid fields after ratings
- Invalid fields
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/c05b832577bceef5.
Report an issue: GitHub.
Appendix: source
Thrown at app/models/rubric_assessment_import.rb:117
rescue => e
ErrorReport.log_exception("rubric_assessments_import", e)
update!(error_count: 1, error_data: [{ message: I18n.t("An error occurred while importing rubrics."), exception: e.message }])
track_error
job_failed!
end
end
def track_error
InstStatsd::Statsd.distributed_increment("#{assignment.class.to_s.downcase}.rubrics.csv_imported_with_error")
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]View on GitHub (pinned to 1c9f0bb801)