instructure/canvas-lms · error · PeerReview::GroupNotFoundError
Group does not exist
Error message
Group does not exist
What it means
PeerReview::GroupNotFoundError raised when validate_group_exists receives a nil/blank group. The service could not load the Group referenced for the override, so it refuses to proceed rather than creating an override bound to a nonexistent group.
Solutions
- Check the group id exists in the target course: course.groups.exists?(group_id)
- Re-fetch the group list for the assignment's group category — the group may have been deleted
- Verify you are not mixing shard-local and global ids in a multi-shard environment
- Pass the Group record itself when the service accepts it, so resolution happens in the right context
Example fix
// before PeerReview::CreateGroupOverride.call(assignment:, group_id: params[:group_id]) // after group = assignment.group_category.groups.find_by(id: params[:group_id]) raise ArgumentError, 'group not in assignment group set' unless group PeerReview::CreateGroupOverride.call(assignment:, group_id: group.id)
Defensive patterns
Strategy: validation
Validate before calling
group = Group.active.find_by(id: group_id) raise ArgumentError, 'group not found' unless group&.context == course
Type guard
null
Try / catch
begin
PeerReview::CreateGroupOverride.call(assignment:, group_id:)
rescue PeerReview::GroupNotFoundError
render json: { error: 'Group does not exist' }, status: :not_found
end Prevention
- Refresh group ids from the API rather than caching stale ids
- Validate the group belongs to the assignment's group_category before calling
- Be careful with global vs local ids in sharded environments
When it happens
Trigger: Calling a PeerReview group override service with a group_id that does not exist, was deleted, or belongs to a different course/shard — the resulting Group lookup returns nil.
Common situations: Stale group id cached in the client after the group was deleted; wrong course context; cross-shard id confusion in a Switchman-sharded Canvas; typo in the id.
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
- Parent assignment Group override not found for group
- Parent assignment ADHOC override not found for students
- Parent assignment Course override not found for course
- Parent assignment Section override not found for section
- Course does not exist
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/93ce6be04a736f56.
Report an issue: GitHub.
Appendix: source
Thrown at app/services/peer_review/validations.rb:239
raise PeerReview::StudentIdsNotInCourseError, I18n.t("Student ids are not in course") if student_ids.blank?
end
def validate_set_type_supported(set_type, services)
unless services.key?(set_type)
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?View on GitHub (pinned to 1c9f0bb801)