{"record":{"id":"08966fcc4506fcd5","repo":"instructure/canvas-lms","slug":"e-model-not-found-set-rubric-self-assessment","errorCode":null,"errorMessage":"#{e.model} not found","messagePattern":"#(.+?) not found","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/set_rubric_self_assessment.rb","lineNumber":65,"sourceCode":"      end\n\n      if assignment.discussion_topic?\n        raise GraphQL::ExecutionError, I18n.t(\"Cannot set rubric self assessment for discussion assignments\")\n      end\n\n      unless assignment.can_update_rubric_self_assessment?\n        raise GraphQL::ExecutionError, I18n.t(\"Assignment has self assessments or due date has passed\")\n      end\n\n      rubric_self_assessment_enabled = input[:rubric_self_assessment_enabled]\n\n      if assignment.update(rubric_self_assessment_enabled:)\n        { rubric_self_assessment_enabled: }\n      else\n        errors_for(assignment)\n      end\n    rescue ActiveRecord::RecordNotFound => e\n      raise GraphQL::ExecutionError, \"#{e.model} not found\"\n    end\n  end\nend\n","sourceCodeStart":47,"sourceCodeEnd":69,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/set_rubric_self_assessment.rb#L47-L69","documentation":"SetRubricSelfAssessment rescues ActiveRecord::RecordNotFound and re-raises it as GraphQL::ExecutionError \"#{e.model} not found\" (app/graphql/mutations/set_rubric_self_assessment.rb:65). The lookup of the assignment or rubric_association by the provided (relay or legacy) ID failed, so the resource does not exist or is invisible to this user.","triggerScenarios":"Calling the mutation with an assignment ID that has no Assignment row; a rubric association ID that no longer exists (association deleted or inactive); IDs from a different shard/course or a typo'd/legacy ID that the relay-id prepare function resolves to nothing.","commonSituations":"Stale UI referencing a deleted rubric association; copying IDs between Canvas environments (beta/production); passing a global ID from another root account; active_rubric_association was removed after the page loaded.","solutions":["Re-fetch the assignment/rubric association IDs from the GraphQL API before mutating.","Verify the ID belongs to the same Canvas environment/shard and course.","Ensure the assignment actually has an active rubric association (assignment.active_rubric_association?).","Handle the error client-side and prompt the user to reload the assignment settings."],"exampleFix":"// before\nmutate({ variables: { id: staleAssignmentId, rubricAssociationId: cachedId } })\n// after\nconst fresh = await client.query({ query: GET_ASSIGNMENT, variables: { id } })\nmutate({ variables: { id: fresh.data.assignment.id, rubricAssociationId: fresh.data.assignment.activeRubricAssociation.id } })","handlingStrategy":"try-catch","validationCode":"const fresh = await client.query({ query: GET_ASSIGNMENT, variables: { id } }); if (!fresh.data.assignment) throw new SkipMutation('assignment not found')","typeGuard":null,"tryCatchPattern":"try { await mutate(...) } catch (e) { if (/not found$/i.test(e.message)) { invalidateCache(); promptReload(); } else throw e; }","preventionTips":["Always re-fetch IDs before mutating; never reuse cached IDs across environments.","Confirm the assignment has an active rubric association.","Use global (relay) IDs from API responses, not hand-built legacy IDs."],"tags":["graphql","record-not-found","active-record","canvas"],"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"}