{"record":{"id":"216904932115529a","repo":"instructure/canvas-lms","slug":"the-file-is-empty-or-does-not-contain-valid-rubric-data","errorCode":null,"errorMessage":"The file is empty or does not contain valid rubric data.","messagePattern":"The file is empty or does not contain valid rubric data\\.","errorType":"validation","errorClass":"DataFormatError","httpStatus":null,"severity":"error","filePath":"app/models/rubric_import.rb","lineNumber":104,"sourceCode":"      ErrorReport.log_exception(\"rubrics_import_data_format\", e)\n      update!(error_count: 1, error_data: [{ message: e.message }])\n      track_error\n      job_failed!\n    rescue CSV::MalformedCSVError => e\n      ErrorReport.log_exception(\"rubrics_import_csv\", e)\n      update!(error_count: 1, error_data: [{ message: I18n.t(\"The file is not a valid CSV file.\"), exception: e.message }])\n      track_error\n    rescue => e\n      ErrorReport.log_exception(\"rubrics_import\", e)\n      update!(error_count: 1, error_data: [{ message: I18n.t(\"An error occurred while importing rubrics.\"), exception: e.message }])\n      track_error\n      job_failed!\n    end\n  end\n\n  def process_rubrics\n    rubrics_by_name = RubricCSVImporter.new(attachment).parse\n    raise DataFormatError, I18n.t(\"The file is empty or does not contain valid rubric data.\") if rubrics_by_name.empty?\n\n    total_rubrics = rubrics_by_name.keys.count\n    error_data = []\n\n    rubrics_by_name.each_with_index do |(rubric_name, rubric_data), rubric_index|\n      raise DataFormatError, I18n.t(\"Missing 'Rubric Name' in some rows.\") if rubric_name.blank?\n\n      rubric = context.rubrics.build(rubric_imports_id: id)\n      criteria_hash = {}\n      rubric_data.each_with_index do |criterion, criterion_index|\n        raise DataFormatError, \"Missing 'Criteria Name' for #{rubric_name}\" if criterion[:description].blank?\n        raise DataFormatError, \"Missing ratings for #{criterion[:description]}\" if criterion[:ratings].empty?\n\n        ratings_hash = {}\n        criterion[:ratings].each_with_index do |rating, rating_index|\n          ratings_hash[rating_index.to_s] = {\n            \"description\" => rating[:description],\n            \"long_description\" => rating[:long_description],","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/models/rubric_import.rb#L86-L122","documentation":"RubricImport#process_rubrics raises DataFormatError when RubricCSVImporter.parse returns an empty hash — the uploaded rubric CSV contained no importable rows (empty file, headers only, or content the importer could not map).","triggerScenarios":"Uploading an empty file, a headers-only CSV, a wrongly formatted rubric CSV (unexpected columns so nothing parses), or the wrong file entirely (e.g. the assessments CSV instead of the rubric CSV).","commonSituations":"Spreadsheet export of the wrong sheet; CSV saved with wrong delimiter or encoding; template columns renamed; uploading a blank template without filling it in; file uploaded as .csv but actually xlsx content.","solutions":["Use the provided rubric CSV template and keep the exact header names ('Rubric Name', criteria, ratings columns)","Re-save the spreadsheet as comma-separated CSV (UTF-8) and confirm rows exist below the header","Ensure the uploaded file is the rubric CSV, not the assessment CSV or another export","Open the CSV in a text editor to verify it has data rows and correct comma delimiters"],"exampleFix":"// before\n# file contains only: Rubric Name,Criteria,Ratings\n// after\nRubric Name,Criteria,Ratings\nEssay Rubric,Quality,\"Great:10,Good:7\"\nEssay Rubric,Accuracy,\"Perfect:10,Fair:5\"","handlingStrategy":"validation","validationCode":"csv = CSV.read(uploaded_path, headers: true)\nraise \"no rubric rows\" if csv.empty?\nraise \"missing 'Rubric Name' column\" unless csv.headers.include?(\"Rubric Name\")","typeGuard":null,"tryCatchPattern":"begin\n  import.process\nrescue DataFormatError => e\n  flash[:error] = e.message\nend","preventionTips":["Use the official rubric CSV template without renaming headers","Ensure at least one fully populated data row exists","Save as comma-separated UTF-8 CSV, not xlsx","Verify in a text editor that rows and delimiters look correct"],"tags":["csv","import","validation","rubrics"],"backgroundTag":"empty-result-set","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"}