instructure/canvas-lms · error · GraphQL::ExecutionError

peer_review_allocation_and_grading feature flag is not…

Error message

peer_review_allocation_and_grading feature flag is not enabled for this course

What it means

This error comes from the AllocationRuleBase GraphQL mutation in Canvas. It is raised by validate_feature_flag! when the course associated with the mutation does not have the :peer_review_allocation_and_grading feature flag enabled. Allocation rules (peer review assessor/assessee assignment) are gated behind this flag, so create/update allocation rule mutations are rejected until it is turned on for that course.

Solutions

  1. Enable the flag for the course: in Rails console run course.enable_feature!(:peer_review_allocation_and_grading) or Account.course-level feature setting via UI (Course Settings > Feature Options).
  2. Enable it at the account level if it should apply to all courses.
  3. Verify you are targeting the intended course ID in the mutation input.
  4. If the flag should not be needed, confirm the mutation is actually an allocation-rule mutation and not a peer-review-only flow.

Example fix

// before
mutation { createAllocationRules(input: { assignmentId: "123", ... }) }
// (fails: flag off for course 456)

// after
# rails console
course = Course.find(456)
course.enable_feature!(:peer_review_allocation_and_grading)
# then retry the same mutation
Defensive patterns

Strategy: validation

Validate before calling

const course = await canvasApi.getCourse(courseId);
if (!course.enabledFeatureFlags?.includes('peer_review_allocation_and_grading')) {
  throw new Error(`Enable peer_review_allocation_and_grading on course ${courseId} first`);
}
// then run the allocation rule mutation

Try / catch

try {
  await runAllocationRuleMutation(input);
} catch (e) {
  if (e.message.includes('feature flag is not enabled')) {
    // surface instruction to enable the flag instead of retrying
  }
}

Prevention

When it happens

Trigger: Calling a createAllocationRule / updateAllocationRule-style mutation (anything inheriting app/graphql/mutations/allocation_rule_base.rb) whose course argument resolves to a course where course.feature_enabled?(:peer_review_allocation_and_grading) returns false.

Common situations: Developers test allocation rule mutations against a course where the flag was never enabled; the flag is enabled at the root/account level but not inherited/overridden for the specific course; a staging environment lacks the feature flag set that production has; UI testing was done in one course then API testing pointed at another course.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/allocation_rule_base.rb:74

      field :assignment_id, ID, null: false
      field :attribute, String, null: true
      field :attribute_id, String, null: true
      field :message, String, null: false

      def assignment_id
        object.assignment&.id&.to_s
      end
    end

    field :allocation_errors, [AllocationErrorType], null: true
    field :allocation_rules, [Types::AllocationRuleType], null: true

    protected

    def validate_feature_flag!(course)
      unless course.feature_enabled?(:peer_review_allocation_and_grading)
        raise GraphQL::ExecutionError, I18n.t("peer_review_allocation_and_grading feature flag is not enabled for this course")
      end
    end

    def validate_id_arrays!(input)
      assessor_ids = input[:assessor_ids]
      assessee_ids = input[:assessee_ids]
      applies_to_assessor = input[:applies_to_assessor]
      reciprocal = input[:reciprocal]

      if reciprocal
        if assessor_ids.length > 1
          raise GraphQL::ExecutionError, I18n.t("Only one assessor is allowed when creating reciprocal rules")
        end
        if assessee_ids.length > 1
          raise GraphQL::ExecutionError, I18n.t("Only one assessee is allowed when creating reciprocal rules")
        end
      elsif applies_to_assessor
        if assessor_ids.length > 1

View on GitHub (pinned to 1c9f0bb801)