instructure/canvas-lms · error · GraphQL::ExecutionError

not found

Error message

not found

What it means

SetOverrideScore wraps its resolve in a rescue of ActiveRecord::RecordNotFound and re-raises a bare "not found" ExecutionError. Any required record (enrollment, user, grading period, score) missing during lookup results in this error.

Solutions

  1. Verify enrollment existence first: Enrollment.active.where(id: enrollment_id).exists?
  2. Confirm the enrollment has a Score for the given grading period (or pass the current-grade score lookup)
  3. Refresh IDs from the course enrollments API before mutating

Example fix

// before
setOverrideScore(enrollmentId: 999, overrideScore: 88)
// after
if Enrollment.active.where(id: 999).exists?
  setOverrideScore(enrollmentId: 999, overrideScore: 88)
end
Defensive patterns

Strategy: validation

Validate before calling

// Ruby
enrollment = Enrollment.active.find_by(id: enrollment_id)
proceed = enrollment.present?

Try / catch

// Ruby
begin
  mutation
rescue GraphQL::ExecutionError => e
  refresh_enrollment_ids if e.message == "not found"
end

Prevention

When it happens

Trigger: Calling setOverrideScore with an enrollment_id (or grading_period_id) that does not exist, or a score record absent for the enrollment/grading-period combination.

Common situations: Stale enrollment id after a student was concluded/deleted and re-enrolled (new id); grading period id from a previous term; client cached IDs across migrations or course copies.

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/ddc4452727f5bc5d. Report an issue: GitHub.

Appendix: source

Thrown at app/graphql/mutations/set_override_score.rb:73

      score = enrollment.update_override_score(
        grading_period_id: input[:grading_period_id],
        override_score: input[:override_score],
        updating_user: current_user,
        record_grade_change: enrollment == requested_enrollment
      )

      next unless enrollment == requested_enrollment

      return_value = if score.valid?
                       { grades: score }
                     else
                       errors_for(score)
                     end
    end

    return_value
  rescue ActiveRecord::RecordNotFound
    raise GraphQL::ExecutionError, "not found"
  end
end

View on GitHub (pinned to 1c9f0bb801)