instructure/canvas-lms · error · GraphQL::ExecutionError
custom grade status not found
Error message
custom grade status not found
What it means
GraphQL::ExecutionError raised in the rescue ActiveRecord::RecordNotFound branch of Mutations::DeleteCustomGradeStatus#resolve when CustomGradeStatus.active.find(input[:id]) finds no active record with that id (deleted, wrong id, or never existed).
Solutions
- Check CustomGradeStatus.active.exists?(id) before calling the mutation
- Handle the error gracefully in the client by refreshing the status list
- Use find_by and skip deletion if already gone for idempotent flows
- Verify the id format (relay vs legacy) matches the argument prepare function
Example fix
// before
// second click after delete
await deleteCustomGradeStatus({ id }) // 'custom grade status not found'
// after
if (statusList.some(s => s.id === id)) {
await deleteCustomGradeStatus({ id })
} Defensive patterns
Strategy: validation
Validate before calling
if (!activeStatuses.some(s => s.id === id)) return // nothing to delete
Try / catch
try {
await deleteCustomGradeStatus(id)
} catch (e) {
if (/not found/.test(e.message)) removeFromLocalList(id) // already gone
} Prevention
- Disable the delete button after the first click
- Refresh status lists after other users' changes
- Treat not-found as idempotent success
When it happens
Trigger: Passing an id of a status that was already destroyed, is soft-deleted (excluded by .active), or does not exist.
Common situations: Double-clicking delete so the second call hits an already-deleted record; stale lists in the gradebook UI after another teacher deleted a status; test fixtures cleaned between runs.
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
- Allocation rule not found
- Assignment not found
- assignment not found: #
- assignment not found
- custom gradebook statuses feature flag is disabled
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/7310151ab663ea5e.
Report an issue: GitHub.
Appendix: source
Thrown at app/graphql/mutations/delete_custom_grade_status.rb:44
raise GraphQL::ExecutionError, "custom gradebook statuses feature flag is disabled" unless Account.site_admin.feature_enabled?(:custom_gradebook_statuses)
custom_grade_status = CustomGradeStatus.active.find(input[:id])
unless custom_grade_status.grants_right?(current_user, session, :delete)
raise GraphQL::ExecutionError, I18n.t("Insufficient permissions")
end
context[:deleted_models] ||= {}
context[:deleted_models][:custom_grade_status] = custom_grade_status
custom_grade_status_id = custom_grade_status.id
custom_grade_status.deleted_by = current_user
custom_grade_status.destroy
InstStatsd::Statsd.distributed_increment("custom_grade_status.graphql.delete")
{ custom_grade_status_id: }
rescue ActiveRecord::RecordNotFound
raise GraphQL::ExecutionError, "custom grade status not found"
end
def self.custom_grade_status_id_log_entry(_entry, context)
context[:deleted_models][:custom_grade_status]
end
end
end
View on GitHub (pinned to 1c9f0bb801)