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

DeleteAllocationRule#validate_feature_flag! requires the course-level feature flag peer_review_allocation_and_grading to be enabled; otherwise it raises GraphQL::ExecutionError before doing any work. Allocation rules are gated behind this peer-review feature flag.

Solutions

  1. Enable the flag: Account site admin -> Feature Options (or course settings) -> enable peer_review_allocation_and_grading for the course.
  2. Set it at the account level if course-level control isn't intended.
  3. In Rails console: course.enable_feature!(:peer_review_allocation_and_grading).
  4. Confirm the flag still exists in this Canvas version; upgrade path may have renamed it.

Example fix

// before
course = Course.find(id) # flag off
deleteAllocationRule(input: { id: ruleId })
// after
# in rails console
course.set_feature_flag!(Feature.definitions['peer_review_allocation_and_grading'], 'on')
deleteAllocationRule(input: { id: ruleId })
Defensive patterns

Strategy: validation

Validate before calling

const flagOn = course.featureFlags?.some(f => f.name === 'peer_review_allocation_and_grading' && f.state === 'allowed_on' || f.state === 'on')
if (!flagOn) throw new SkipError('feature flag disabled for this course')

Type guard

function flagEnabled(flags, name) { return (flags || []).some(f => f.name === name && ['on','allowed_on','enabled'].includes(f.state)); }

Try / catch

try {
  await deleteAllocationRule({ id })
} catch (e) {
  if (e.message.includes('feature flag is not enabled')) {
    promptAdminToEnableFlag('peer_review_allocation_and_grading')
  } else throw e;
}

Prevention

When it happens

Trigger: Calling deleteAllocationRule (or related allocation-rule mutations) against a course where the peer_review_allocation_and_grading feature flag is off (not enabled at course, account, or site level).

Common situations: Testing against a course in an account that hasn't enabled the flag; flag enabled only in a dev environment but code pointed at production; flag removed/renamed in a Canvas upgrade; admin enabled it on root account but course-level override forces it off.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/delete_allocation_rule.rb:55

      allocation_rule_id: record.id
    }
  end

  def self.allocation_rule_id_log_entry(_entry, context)
    context[:deleted_models][:allocation_rule]
  end

  private

  def get_allocation_rule(rule_id)
    AllocationRule.active.find(rule_id)
  rescue ActiveRecord::RecordNotFound
    raise GraphQL::ExecutionError, I18n.t("Allocation rule not found")
  end

  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
end

View on GitHub (pinned to 1c9f0bb801)