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

Peer Review Allocation and Grading feature flag is disabled

Error message

Peer Review Allocation and Grading feature flag is disabled

What it means

PeerReview::Validations#validate_feature_enabled raises PeerReview::FeatureDisabledError when the assignment's root account/context does not have the `:peer_review_allocation_and_grading` feature flag enabled. This new peer review allocation/grading functionality is gated behind a Canvas feature flag, so all peer review sub assignment operations fail until the flag is on.

Solutions

  1. Enable the feature flag: in Rails console `Account.root_lti_context_of(...)`/account.feature_flags - or SiteAdmin/account UI: enable `:peer_review_allocation_and_grading`.
  2. Via console: `account.enable_feature! :peer_review_allocation_and_grading` (or set flag state to 'on' for the specific sub-account).
  3. Check `assignment.context.feature_enabled?(:peer_review_allocation_and_grading)` before calling peer review APIs and surface a friendly message.

Example fix

// before
PeerReview::SubAssignmentCreator.new(assignment: assignment).call # flag off
// after
# enable in account console first:
# account.set_feature_flag!(Feature::Flag.new(feature: :peer_review_allocation_and_grading, state: 'on'))
PeerReview::SubAssignmentCreator.new(assignment: assignment).call
Defensive patterns

Strategy: validation

Validate before calling

unless assignment.context.feature_enabled?(:peer_review_allocation_and_grading)
  return render json: { error: "feature disabled" }, status: :forbidden
end

Try / catch

begin
  service.call
rescue PeerReview::FeatureDisabledError => e
  render json: { error: e.message }, status: :forbidden
end

Prevention

When it happens

Trigger: Any peer review sub assignment creation/update on an account where the `peer_review_allocation_and_grading` feature flag is 'off' or 'allowed' but not enabled in the assignment's context.

Common situations: Testing on a local/self-hosted Canvas where the flag was never turned on; production rollout where only some accounts have the flag enabled; staging environments lagging behind flag rollout.

Related errors


AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15). Data as JSON: /api/errors/2d8b3bee28ce2a4d. Report an issue: GitHub.

Appendix: source

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

# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.

module PeerReview::Validations
  def validate_parent_assignment(assignment)
    unless assignment.present? && assignment.is_a?(Assignment) && assignment.persisted?
      raise PeerReview::InvalidParentAssignmentError, I18n.t("Invalid parent assignment")
    end
  end

  def validate_peer_reviews_enabled(assignment)
    unless assignment.peer_reviews?
      raise PeerReview::PeerReviewsNotEnabledError, I18n.t("Peer reviews are not enabled for this assignment")
    end
  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)

View on GitHub (pinned to 1c9f0bb801)