{"record":{"id":"3bc7bc9cb8f9b528","repo":"instructure/canvas-lms","slug":"rubric-association-not-found","errorCode":null,"errorMessage":"Rubric Association not found","messagePattern":"Rubric Association not found","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/set_rubric_self_assessment.rb","lineNumber":34,"sourceCode":"#\n# You should have received a copy of the GNU Affero General Public License along\n# with this program. If not, see <http://www.gnu.org/licenses/>.\n#\nmodule Mutations\n  class SetRubricSelfAssessment < BaseMutation\n    argument :assignment_id, ID, required: true\n    argument :rubric_self_assessment_enabled, Boolean, required: true\n\n    def resolve(input:)\n      assignment = Assignment.find(input[:assignment_id])\n      rubric_association = assignment.rubric_association\n\n      unless Rubric.rubric_self_assessment_enabled?(assignment.course)\n        raise GraphQL::ExecutionError, \"enhanced_rubrics, rubric_self_assesment and assignments_2_student must be enabled\"\n      end\n\n      unless assignment.active_rubric_association?\n        raise GraphQL::ExecutionError, I18n.t(\"Rubric Association not found\")\n      end\n\n      unless rubric_association.grants_right?(current_user, session, :update)\n        raise GraphQL::ExecutionError, I18n.t(\"Insufficient permissions\")\n      end\n\n      if assignment.has_group_category?\n        raise GraphQL::ExecutionError, I18n.t(\"Cannot set rubric self assessment for group assignments\")\n      end\n\n      if assignment.quiz_lti? || assignment.quiz?\n        raise GraphQL::ExecutionError, I18n.t(\"Cannot set rubric self assessment for quiz assignments\")\n      end\n\n      if assignment.discussion_topic?\n        raise GraphQL::ExecutionError, I18n.t(\"Cannot set rubric self assessment for discussion assignments\")\n      end\n","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/set_rubric_self_assessment.rb#L16-L52","documentation":"If the assignment exists but has no active rubric association (assignment.active_rubric_association? is false), resolve raises \"Rubric Association not found\". The mutation needs a live rubric_assessments association to create a self-assessment against.","triggerScenarios":"Calling setRubricSelfAssessment for an assignment whose rubric was deleted or replaced, an assignment that never had a rubric added, or after a rubric import/copy that deactivated the association.","commonSituations":"Teacher removed the rubric after the student page loaded; course copy where rubric associations did not carry over; assignment graded without rubric in another workflow.","solutions":["Add/re-add a rubric to the assignment in the UI so an active rubric_association exists","Verify with assignment.active_rubric_association? before calling the mutation","If the rubric was deleted, restore it or choose an assignment that still has one"],"exampleFix":"// before\nsetRubricSelfAssessment(assignmentId: 5, ...)\n// after\nif assignment.active_rubric_association?\n  setRubricSelfAssessment(assignmentId: 5, ...)\nelse\n  Rails.logger.warn(\"assignment 5 has no active rubric association\")\nend","handlingStrategy":"validation","validationCode":"// Ruby\nhas_rubric = assignment.active_rubric_association?","typeGuard":null,"tryCatchPattern":"// Ruby\nbegin\n  mutation\nrescue GraphQL::ExecutionError => e\n  prompt_add_rubric if e.message == \"Rubric Association not found\"\nend","preventionTips":["Confirm the assignment still has a rubric before showing self-assessment UI","Re-check after course copies/imports which may drop rubric associations","Listen for rubric deletion events to invalidate cached assignment state"],"tags":["graphql","ruby","rubrics","assignments"],"backgroundTag":"entity-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"}