{"record":{"id":"7d031121d9ccaf74","repo":"instructure/canvas-lms","slug":"parent-assignment-adhoc-override-not-found-for-students","errorCode":null,"errorMessage":"Parent assignment ADHOC override not found for students %{student_ids}","messagePattern":"Parent assignment ADHOC override not found for students %(.+?)","errorType":"validation","errorClass":"PeerReview::ParentOverrideNotFoundError","httpStatus":null,"severity":"error","filePath":"app/services/peer_review/validations.rb","lineNumber":244,"sourceCode":"      supported_types = services.keys.join(\", \")\n      raise PeerReview::SetTypeNotSupportedError,\n            I18n.t(\"Set type '%{set_type}' is not supported. Supported types are: %{supported_types}\", set_type:, supported_types:)\n    end\n  end\n\n  def validate_group_assignment_required(assignment)\n    unless assignment.group_category_id\n      raise PeerReview::GroupAssignmentRequiredError, I18n.t(\"Must be a group assignment to create group overrides\")\n    end\n  end\n\n  def validate_group_exists(group)\n    raise PeerReview::GroupNotFoundError, I18n.t(\"Group does not exist\") unless group.present?\n  end\n\n  def validate_adhoc_parent_override_exists(parent_override, student_ids)\n    unless parent_override.present?\n      raise PeerReview::ParentOverrideNotFoundError,\n            I18n.t(\"Parent assignment ADHOC override not found for students %{student_ids}\", student_ids: student_ids.join(\", \"))\n    end\n  end\n\n  def validate_course_parent_override_exists(parent_override, course_id)\n    unless parent_override.present?\n      raise PeerReview::ParentOverrideNotFoundError,\n            I18n.t(\"Parent assignment Course override not found for course %{course_id}\", course_id:)\n    end\n  end\n\n  def validate_group_parent_override_exists(parent_override, group_id)\n    unless parent_override.present?\n      raise PeerReview::ParentOverrideNotFoundError,\n            I18n.t(\"Parent assignment Group override not found for group %{group_id}\", group_id:)\n    end\n  end\n","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/services/peer_review/validations.rb#L226-L262","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Create the parent ADHOC override first (ensure the ADHOC override covering those student_ids exists), then create the child override","Re-run the parent-override creation step for the exact same student_ids list","Check for a previously deleted/failed parent override transaction and recreate it","Verify student ids match (same set, same order/format) those used when the parent override was created"],"exampleFix":"// before\nPeerReview::CreateGroupChildOverride.call(parent_override: nil, student_ids: ids)\n// after\nparent = PeerReview::EnsureAdhocParentOverride.call(assignment:, student_ids: ids)\nPeerReview::CreateGroupChildOverride.call(parent_override: parent, student_ids: ids)","handlingStrategy":"try-catch","validationCode":"parent = AssignmentOverride.active.adhoc.where(assignment_id: assignment.id)\n  .joins(assignment_override_students: :user)\n  .where(assignment_override_students: { user_id: student_ids })\n  .exists?","typeGuard":"null","tryCatchPattern":"begin\n  PeerReview::CreateChildOverride.call(...)\nrescue PeerReview::ParentOverrideNotFoundError => e\n  # recreate the parent ADHOC override then retry once\n  PeerReview::EnsureAdhocParentOverride.call(assignment:, student_ids:)\n  retry\nend","preventionTips":["Always create parent overrides before child overrides in the same transaction","Use idempotent 'ensure parent' helpers instead of raw child creation","Verify student_ids match the parent's set exactly"],"tags":["ruby","rails","peer-review","overrides","not-found"],"backgroundTag":"record-not-found","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}