instructure/canvas-lms · error · PeerReview::InvalidAssignmentSubmissionTypesError
Peer reviews cannot be used with Discussion Topic…
Error message
Peer reviews cannot be used with Discussion Topic assignments
What it means
The same validate_assignment_submission_types method raises PeerReview::InvalidAssignmentSubmissionTypesError when `assignment.submission_types == "discussion_topic"`. Discussion topic assignments are excluded from peer review sub assignments, so the library rejects them.
Solutions
- Use a standard online-submission assignment instead of a graded discussion for peer reviews.
- Check `assignment.submission_types == "discussion_topic"` and skip peer review creation for those.
- Note that legacy discussion_topic peer review behavior differs from the new sub assignment flow; keep using the legacy path for discussions.
Example fix
// before PeerReview::SubAssignmentCreator.new(assignment: discussion_assignment).call // after unless discussion_assignment.submission_types == "discussion_topic" PeerReview::SubAssignmentCreator.new(assignment: discussion_assignment).call end
Defensive patterns
Strategy: validation
Validate before calling
raise ArgumentError, "discussion topics cannot use peer review sub assignments" if assignment.submission_types == "discussion_topic"
Try / catch
begin
service.call
rescue PeerReview::InvalidAssignmentSubmissionTypesError => e
render json: { error: e.message }, status: :unprocessable_entity
end Prevention
- Exclude discussion_topic submission_types in bulk peer review scripts
- Keep graded discussions on the legacy peer review path
- Check submission_types before showing the peer review toggle
When it happens
Trigger: Enabling peer reviews / creating a peer review sub assignment on an assignment whose submission_types is exactly 'discussion_topic'.
Common situations: Graded discussions with peer reviews requested by instructors; automation enabling peer review for every assignment type in a course; API clients copying settings from discussion assignments.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Due date cannot be before available from date
- Invalid parent assignment
- Must be a group assignment to create group overrides
- Peer review sub assignment does not exist
- Peer review sub assignment exists
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/7062f89f0822864a.
Report an issue: GitHub.
Appendix: source
Thrown at app/services/peer_review/validations.rb:49
end
def validate_feature_enabled(assignment)
unless assignment.context.feature_enabled?(:peer_review_allocation_and_grading)
raise PeerReview::FeatureDisabledError, I18n.t("Peer Review Allocation and Grading feature flag is disabled")
end
end
def validate_grading_type(grading_type)
raise PeerReview::InvalidGradingTypeError, I18n.t("Peer review sub assignments cannot have a not_graded grading type") if grading_type == "not_graded"
end
def validate_assignment_submission_types(assignment)
if assignment.external_tool?
raise PeerReview::InvalidAssignmentSubmissionTypesError, I18n.t("Peer reviews cannot be used with External Tool assignments")
end
if assignment.submission_types == "discussion_topic"
raise PeerReview::InvalidAssignmentSubmissionTypesError, I18n.t("Peer reviews cannot be used with Discussion Topic assignments")
end
end
def validate_peer_review_sub_assignment_exists(assignment)
if assignment.peer_review_sub_assignment.blank?
raise PeerReview::SubAssignmentNotExistError, I18n.t("Peer review sub assignment does not exist")
end
end
def validate_peer_review_sub_assignment_not_exist(assignment)
if assignment.peer_review_sub_assignment.present?
raise PeerReview::SubAssignmentExistsError, I18n.t("Peer review sub assignment exists")
end
end
# Validates that peer review dates follow the restriction below
# peer review unlock_at < peer review due_at <= peer review lock_at
def validate_peer_review_dates(peer_review_dates)View on GitHub (pinned to 1c9f0bb801)