{"record":{"id":"62afb234884caac7","repo":"instructure/canvas-lms","slug":"peer-review-allocation-and-grading-feature-flag-is-not","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/allocation_rule_base.rb","lineNumber":74,"sourceCode":"\n      field :assignment_id, ID, null: false\n      field :attribute, String, null: true\n      field :attribute_id, String, null: true\n      field :message, String, null: false\n\n      def assignment_id\n        object.assignment&.id&.to_s\n      end\n    end\n\n    field :allocation_errors, [AllocationErrorType], null: true\n    field :allocation_rules, [Types::AllocationRuleType], null: true\n\n    protected\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\n\n    def validate_id_arrays!(input)\n      assessor_ids = input[:assessor_ids]\n      assessee_ids = input[:assessee_ids]\n      applies_to_assessor = input[:applies_to_assessor]\n      reciprocal = input[:reciprocal]\n\n      if reciprocal\n        if assessor_ids.length > 1\n          raise GraphQL::ExecutionError, I18n.t(\"Only one assessor is allowed when creating reciprocal rules\")\n        end\n        if assessee_ids.length > 1\n          raise GraphQL::ExecutionError, I18n.t(\"Only one assessee is allowed when creating reciprocal rules\")\n        end\n      elsif applies_to_assessor\n        if assessor_ids.length > 1","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/allocation_rule_base.rb#L56-L92","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Enable it at the account level if it should apply to all courses.","Verify you are targeting the intended course ID in the mutation input.","If the flag should not be needed, confirm the mutation is actually an allocation-rule mutation and not a peer-review-only flow."],"exampleFix":"// before\nmutation { createAllocationRules(input: { assignmentId: \"123\", ... }) }\n// (fails: flag off for course 456)\n\n// after\n# rails console\ncourse = Course.find(456)\ncourse.enable_feature!(:peer_review_allocation_and_grading)\n# then retry the same mutation","handlingStrategy":"validation","validationCode":"const course = await canvasApi.getCourse(courseId);\nif (!course.enabledFeatureFlags?.includes('peer_review_allocation_and_grading')) {\n  throw new Error(`Enable peer_review_allocation_and_grading on course ${courseId} first`);\n}\n// then run the allocation rule mutation","typeGuard":null,"tryCatchPattern":"try {\n  await runAllocationRuleMutation(input);\n} catch (e) {\n  if (e.message.includes('feature flag is not enabled')) {\n    // surface instruction to enable the flag instead of retrying\n  }\n}","preventionTips":["Check course.enabled_feature_flags before any allocation-rule call","Enable the flag at account level for consistent test environments","Keep flag settings in parity between staging and production","Target the exact course ID the flag was enabled on"],"tags":["graphql","feature-flag","peer-review","canvas"],"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"}