instructure/canvas-lms · error · GraphQL::ExecutionError
standard grade status not found
Error message
standard grade status not found
What it means
Raised by UpsertStandardGradeStatus when ActiveRecord::RecordNotFound escapes resolve — specifically when input[:id] is given but root_account.standard_grade_statuses.find_by!(id:..., status_name:...) matches no row. The rescue clause converts it to a GraphQL::ExecutionError.
Solutions
- Confirm both the id AND status_name exactly match an existing record (root_account.standard_grade_statuses.find_by(id: x, status_name: n))
- If the name changed, pass the current status_name — the lookup requires both to match
- Verify you are operating on the correct root account/shard
- Create the status without :id if it genuinely does not exist yet
Example fix
// before
updateStandardGradeStatus({ id: "7", name: "masterd", color: "#0F0" }) // typo'd name
// after
updateStandardGradeStatus({ id: "7", name: "mastery", color: "#0F0" }) // exact stored name Defensive patterns
Strategy: validation
Validate before calling
const match = standardGradeStatuses.find(s => s.id === inputId && s.name === inputName)
if (!match) throw new Error('no status matches given id and name') Try / catch
try {
await client.mutate(UPSERT_STANDARD_GRADE_STATUS, { id, name, color })
} catch (e) {
if (/standard grade status not found/.test(e.message)) {
await refetchStatuses() // id/name mismatch or deleted
} else throw e
} Prevention
- Always pass the exact stored status_name together with the id
- Re-fetch after renames; never send stale name/id pairs
- Confirm the record lives on the queried root account/shard
When it happens
Trigger: Providing input :id that does not exist on the domain root account, OR providing an id that exists but whose status_name does not match the name argument (find_by! requires both id and status_name to match), OR the record lives on a different shard.
Common situations: Renaming a status client-side then updating by an old name+id pair; id/name mismatch after someone renamed the status; wrong root account (multi-tenant); stale id after the status was deleted.
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
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/4c72f5a507ed79ac.
Report an issue: GitHub.
Appendix: source
Thrown at app/graphql/mutations/upsert_standard_grade_status.rb:44
def resolve(input:)
raise GraphQL::ExecutionError, "custom gradebook statuses feature flag is disabled" unless Account.site_admin.feature_enabled?(:custom_gradebook_statuses)
root_account = context[:domain_root_account]
standard_grade_status = input[:id] ? root_account.standard_grade_statuses.find_by!(id: input[:id], status_name: input[:name]) : StandardGradeStatus.new(root_account:, status_name: input[:name])
required_permission = standard_grade_status.new_record? ? :create : :update
unless standard_grade_status.grants_right?(current_user, session, required_permission)
raise GraphQL::ExecutionError, I18n.t("Insufficient permissions")
end
if standard_grade_status.update(color: input[:color])
{ standard_grade_status: }
else
errors_for(standard_grade_status)
end
rescue ActiveRecord::RecordNotFound
raise GraphQL::ExecutionError, "standard grade status not found"
end
end
end
View on GitHub (pinned to 1c9f0bb801)