instructure/canvas-lms · error · GraphQL::ExecutionError
# not found
Error message
#{e.model} not found What it means
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.
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.
Example fix
// before
mutate({ variables: { id: staleAssignmentId, rubricAssociationId: cachedId } })
// after
const fresh = await client.query({ query: GET_ASSIGNMENT, variables: { id } })
mutate({ variables: { id: fresh.data.assignment.id, rubricAssociationId: fresh.data.assignment.activeRubricAssociation.id } }) Defensive patterns
Strategy: try-catch
Validate before calling
const fresh = await client.query({ query: GET_ASSIGNMENT, variables: { id } }); if (!fresh.data.assignment) throw new SkipMutation('assignment not found') Try / catch
try { await mutate(...) } catch (e) { if (/not found$/i.test(e.message)) { invalidateCache(); promptReload(); } else throw e; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- not found
- A course with that id does not exist
- A maximum of 50 assessees can be provided at once
- A maximum of 50 assessors can be provided at once
- ActiveRecord::RecordNotFound
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/08966fcc4506fcd5.
Report an issue: GitHub.
Appendix: source
Thrown at app/graphql/mutations/set_rubric_self_assessment.rb:65
end
if assignment.discussion_topic?
raise GraphQL::ExecutionError, I18n.t("Cannot set rubric self assessment for discussion assignments")
end
unless assignment.can_update_rubric_self_assessment?
raise GraphQL::ExecutionError, I18n.t("Assignment has self assessments or due date has passed")
end
rubric_self_assessment_enabled = input[:rubric_self_assessment_enabled]
if assignment.update(rubric_self_assessment_enabled:)
{ rubric_self_assessment_enabled: }
else
errors_for(assignment)
end
rescue ActiveRecord::RecordNotFound => e
raise GraphQL::ExecutionError, "#{e.model} not found"
end
end
end
View on GitHub (pinned to 1c9f0bb801)