instructure/canvas-lms · error · PeerReview::ParentOverrideNotFoundError

Parent assignment ADHOC override not found for students

Error message

Parent assignment ADHOC override not found for students %{student_ids}

What it means

PeerReview::ParentOverrideNotFoundError raised when validate_adhoc_parent_override_exists cannot find the parent ADHOC AssignmentOverride covering the given student_ids. Group overrides for peer review are created as children of an existing parent override; without the parent, child overrides cannot be created.

Solutions

  1. Create the parent ADHOC override first (ensure the ADHOC override covering those student_ids exists), then create the child override
  2. Re-run the parent-override creation step for the exact same student_ids list
  3. Check for a previously deleted/failed parent override transaction and recreate it
  4. Verify student ids match (same set, same order/format) those used when the parent override was created

Example fix

// before
PeerReview::CreateGroupChildOverride.call(parent_override: nil, student_ids: ids)
// after
parent = PeerReview::EnsureAdhocParentOverride.call(assignment:, student_ids: ids)
PeerReview::CreateGroupChildOverride.call(parent_override: parent, student_ids: ids)
Defensive patterns

Strategy: try-catch

Validate before calling

parent = AssignmentOverride.active.adhoc.where(assignment_id: assignment.id)
  .joins(assignment_override_students: :user)
  .where(assignment_override_students: { user_id: student_ids })
  .exists?

Type guard

null

Try / catch

begin
  PeerReview::CreateChildOverride.call(...)
rescue PeerReview::ParentOverrideNotFoundError => e
  # recreate the parent ADHOC override then retry once
  PeerReview::EnsureAdhocParentOverride.call(assignment:, student_ids:)
  retry
end

Prevention

When it happens

Trigger: Calling a PeerReview child-override creation service with student_ids whose parent ADHOC override was never created, was deleted, or was created with a different set of student ids.

Common situations: Skipping the create-parent-override step in the API flow; parent override deleted when its students changed; student ids ordered differently so the parent lookup misses; running child creation before parent creation completes.

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

Appendix: source

Thrown at app/services/peer_review/validations.rb:244

      supported_types = services.keys.join(", ")
      raise PeerReview::SetTypeNotSupportedError,
            I18n.t("Set type '%{set_type}' is not supported. Supported types are: %{supported_types}", set_type:, supported_types:)
    end
  end

  def validate_group_assignment_required(assignment)
    unless assignment.group_category_id
      raise PeerReview::GroupAssignmentRequiredError, I18n.t("Must be a group assignment to create group overrides")
    end
  end

  def validate_group_exists(group)
    raise PeerReview::GroupNotFoundError, I18n.t("Group does not exist") unless group.present?
  end

  def validate_adhoc_parent_override_exists(parent_override, student_ids)
    unless parent_override.present?
      raise PeerReview::ParentOverrideNotFoundError,
            I18n.t("Parent assignment ADHOC override not found for students %{student_ids}", student_ids: student_ids.join(", "))
    end
  end

  def validate_course_parent_override_exists(parent_override, course_id)
    unless parent_override.present?
      raise PeerReview::ParentOverrideNotFoundError,
            I18n.t("Parent assignment Course override not found for course %{course_id}", course_id:)
    end
  end

  def validate_group_parent_override_exists(parent_override, group_id)
    unless parent_override.present?
      raise PeerReview::ParentOverrideNotFoundError,
            I18n.t("Parent assignment Group override not found for group %{group_id}", group_id:)
    end
  end

View on GitHub (pinned to 1c9f0bb801)