{"record":{"id":"ddc4452727f5bc5d","repo":"instructure/canvas-lms","slug":"not-found-set-override-score","errorCode":null,"errorMessage":"not found","messagePattern":"not found","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/set_override_score.rb","lineNumber":73,"sourceCode":"      score = enrollment.update_override_score(\n        grading_period_id: input[:grading_period_id],\n        override_score: input[:override_score],\n        updating_user: current_user,\n        record_grade_change: enrollment == requested_enrollment\n      )\n\n      next unless enrollment == requested_enrollment\n\n      return_value = if score.valid?\n                       { grades: score }\n                     else\n                       errors_for(score)\n                     end\n    end\n\n    return_value\n  rescue ActiveRecord::RecordNotFound\n    raise GraphQL::ExecutionError, \"not found\"\n  end\nend\n","sourceCodeStart":55,"sourceCodeEnd":76,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/set_override_score.rb#L55-L76","documentation":"SetOverrideScore wraps its resolve in a rescue of ActiveRecord::RecordNotFound and re-raises a bare \"not found\" ExecutionError. Any required record (enrollment, user, grading period, score) missing during lookup results in this error.","triggerScenarios":"Calling setOverrideScore with an enrollment_id (or grading_period_id) that does not exist, or a score record absent for the enrollment/grading-period combination.","commonSituations":"Stale enrollment id after a student was concluded/deleted and re-enrolled (new id); grading period id from a previous term; client cached IDs across migrations or course copies.","solutions":["Verify enrollment existence first: Enrollment.active.where(id: enrollment_id).exists?","Confirm the enrollment has a Score for the given grading period (or pass the current-grade score lookup)","Refresh IDs from the course enrollments API before mutating"],"exampleFix":"// before\nsetOverrideScore(enrollmentId: 999, overrideScore: 88)\n// after\nif Enrollment.active.where(id: 999).exists?\n  setOverrideScore(enrollmentId: 999, overrideScore: 88)\nend","handlingStrategy":"validation","validationCode":"// Ruby\nenrollment = Enrollment.active.find_by(id: enrollment_id)\nproceed = enrollment.present?","typeGuard":null,"tryCatchPattern":"// Ruby\nbegin\n  mutation\nrescue GraphQL::ExecutionError => e\n  refresh_enrollment_ids if e.message == \"not found\"\nend","preventionTips":["Re-fetch enrollment ids when students are concluded/re-enrolled (ids change)","Confirm a Score exists for the target grading period before setting override scores","Pass nil rather than stale ids when a grading period was deleted"],"tags":["graphql","ruby","gradebook","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"}