{"record":{"id":"e6262a3df9e1327f","repo":"instructure/canvas-lms","slug":"peer-review-allocation-and-grading-feature-flag-is-not-e6262a","errorCode":null,"errorMessage":"peer_review_allocation_and_grading feature flag is not enabled for this course","messagePattern":"peer_review_allocation_and_grading feature flag is not enabled for this course","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/delete_allocation_rule.rb","lineNumber":55,"sourceCode":"      allocation_rule_id: record.id\n    }\n  end\n\n  def self.allocation_rule_id_log_entry(_entry, context)\n    context[:deleted_models][:allocation_rule]\n  end\n\n  private\n\n  def get_allocation_rule(rule_id)\n    AllocationRule.active.find(rule_id)\n  rescue ActiveRecord::RecordNotFound\n    raise GraphQL::ExecutionError, I18n.t(\"Allocation rule not found\")\n  end\n\n  def validate_feature_flag!(course)\n    unless course.feature_enabled?(:peer_review_allocation_and_grading)\n      raise GraphQL::ExecutionError, I18n.t(\"peer_review_allocation_and_grading feature flag is not enabled for this course\")\n    end\n  end\nend\n","sourceCodeStart":37,"sourceCodeEnd":59,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/delete_allocation_rule.rb#L37-L59","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Enable the flag: Account site admin -> Feature Options (or course settings) -> enable peer_review_allocation_and_grading for the course.","Set it at the account level if course-level control isn't intended.","In Rails console: course.enable_feature!(:peer_review_allocation_and_grading).","Confirm the flag still exists in this Canvas version; upgrade path may have renamed it."],"exampleFix":"// before\ncourse = Course.find(id) # flag off\ndeleteAllocationRule(input: { id: ruleId })\n// after\n# in rails console\ncourse.set_feature_flag!(Feature.definitions['peer_review_allocation_and_grading'], 'on')\ndeleteAllocationRule(input: { id: ruleId })","handlingStrategy":"validation","validationCode":"const flagOn = course.featureFlags?.some(f => f.name === 'peer_review_allocation_and_grading' && f.state === 'allowed_on' || f.state === 'on')\nif (!flagOn) throw new SkipError('feature flag disabled for this course')","typeGuard":"function flagEnabled(flags, name) { return (flags || []).some(f => f.name === name && ['on','allowed_on','enabled'].includes(f.state)); }","tryCatchPattern":"try {\n  await deleteAllocationRule({ id })\n} catch (e) {\n  if (e.message.includes('feature flag is not enabled')) {\n    promptAdminToEnableFlag('peer_review_allocation_and_grading')\n  } else throw e;\n}","preventionTips":["Enable the flag in each environment's course/account before testing allocation rules.","Surface feature-flag state in admin UI before showing allocation rule controls.","Check flag at root account level, not just course level."],"tags":["graphql","feature-flag","permissions"],"backgroundTag":"feature-not-enabled","analyzedSha":"1c9f0bb8013ed69c4f2efe11fd483025469b7e6c","analyzedAt":"2026-09-15T20:33:18.891Z","contentChangedAt":"2026-09-15T20:33:18.891Z","schemaVersion":2},"datasetVersion":"2026-09-23T02:17:17.105Z"}