instructure/canvas-lms · error · GraphQL::ExecutionError
# not found
Error message
#{e.model} not found What it means
Within SetOverrideStatus, any ActiveRecord::RecordNotFound raised while loading the enrollment, score, or custom grade status is re-raised as "#{e.model} not found", naming the missing model class. It also rescues RecordInvalid into validation errors separately.
Solutions
- Pre-verify each ID: Enrollment.find_by(id: ...), CustomGradeStatus.find_by(id: ...) before calling
- Refresh the custom grade status list from the course before applying
- Check whether the GraphQL global ID needs conversion to a local numeric id
Example fix
// before
customGradeStatus(enrollmentId: 12, customGradeStatusId: 77)
// after
status = CustomGradeStatus.find_by(id: 77)
if status
customGradeStatus(enrollmentId: 12, customGradeStatusId: 77)
else
Rails.logger.warn("custom grade status 77 missing")
end Defensive patterns
Strategy: validation
Validate before calling
// Ruby ok = Enrollment.find_by(id: enrollment_id) && CustomGradeStatus.find_by(id: status_id)
Type guard
// Ruby status = CustomGradeStatus.find_by(id: custom_grade_status_id) proceed = status.is_a?(CustomGradeStatus)
Try / catch
// Ruby begin mutation rescue GraphQL::ExecutionError => e # e.message like "Enrollment not found" / "CustomGradeStatus not found" refresh_missing_record(e.message) end
Prevention
- Refresh custom grade status lists before applying (statuses can be deleted)
- Convert relay global ids to local ids consistently
- Check both enrollment and status exist in the same context
When it happens
Trigger: Passing a nonexistent enrollment_id, a custom_grade_status_id that does not exist (CustomGradeStatus.find fails), or a score lookup miss for the enrollment/grading period pair.
Common situations: Custom grade status deleted by an admin after the UI loaded; enrollment id from a different course; typing a global vs local ID mismatch in GraphQL relay-style ID fields.
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
- custom gradebook statuses feature flag is disabled
- Insufficient permissions
- No such outcome for id
- not found
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/51b23030b5be305c.
Report an issue: GitHub.
Appendix: source
Thrown at app/graphql/mutations/set_override_status.rb:43
field :grades, Types::GradesType, null: true
def resolve(input:)
raise GraphQL::ExecutionError, "custom gradebook statuses feature flag is disabled" unless Account.site_admin.feature_enabled?(:custom_gradebook_statuses)
score = score(input:)
unless score.grants_right?(current_user, session, :update_custom_status)
raise GraphQL::ExecutionError, I18n.t("Insufficient permissions")
end
enrollment = Enrollment.find_by(id: input[:enrollment_id])
custom_grade_status = get_custom_grade_status(input:)
grading_period_id = input[:grading_period_id]
updated_score = enrollment.update_override_status(custom_grade_status:, grading_period_id:)
InstStatsd::Statsd.distributed_increment("custom_grade_status.applied_to.final_grade")
{ grades: updated_score }
rescue ActiveRecord::RecordNotFound => e
raise GraphQL::ExecutionError, "#{e.model} not found"
rescue ActiveRecord::RecordInvalid => e
errors_for(e.record)
end
private
def score(input:)
Score.find_by!(
assignment_group_id: nil,
course_score: input[:grading_period_id].blank?,
enrollment_id: input[:enrollment_id],
grading_period_id: input[:grading_period_id],
root_account_id: context[:domain_root_account].id
)
end
def get_custom_grade_status(input:)
id = input[:custom_grade_status_id]View on GitHub (pinned to 1c9f0bb801)