{"record":{"id":"e863fa24e35e0a18","repo":"instructure/canvas-lms","slug":"only-one-assessee-is-allowed-when-creating-reciprocal-rules","errorCode":null,"errorMessage":"Only one assessee is allowed when creating reciprocal rules","messagePattern":"Only one assessee is allowed when creating reciprocal rules","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/allocation_rule_base.rb","lineNumber":89,"sourceCode":"\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\n          raise GraphQL::ExecutionError, I18n.t(\"Only one assessor is allowed when rule applies to assessor\")\n        end\n      elsif assessee_ids.length > 1\n        raise GraphQL::ExecutionError, I18n.t(\"Only one assessee is allowed when rule applies to assessee\")\n      end\n\n      if assessor_ids.empty?\n        raise GraphQL::ExecutionError, I18n.t(\"At least one assessor is required\")\n      end\n      if assessee_ids.empty?\n        raise GraphQL::ExecutionError, I18n.t(\"At least one assessee is required\")\n      end\n\n      if assessor_ids.length > 50\n        raise GraphQL::ExecutionError, I18n.t(\"A maximum of 50 assessors can be provided at once\")","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/allocation_rule_base.rb#L71-L107","documentation":"Raised by validate_id_arrays! in AllocationRuleBase when reciprocal: true but the assessee_ids array contains more than one ID. A reciprocal rule must pair a single assessor with a single assessee, so multiple assessees are rejected with a GraphQL ExecutionError.","triggerScenarios":"Calling an allocation-rule create mutation with input { reciprocal: true, assessorIds: [one-id], assesseeIds: [x, y] } — assessee_ids.length > 1 while reciprocal is set.","commonSituations":"Bulk-selecting multiple students in a UI that then submits one mutation with reciprocal enabled; mixing reciprocal and bulk semantic modes in a shared form component; assuming reciprocal distributes the single assessor across all listed assessees (it does not).","solutions":["Send exactly one assessee ID when reciprocal: true.","Create separate mutation calls for each reciprocal pair.","Drop reciprocal: true if multiple assessees per assessor are intended.","Guard the UI so reciprocal mode disables multi-select for both lists."],"exampleFix":"// before\n{ reciprocal: true, assessorIds: [\"11\"], assesseeIds: [\"21\", \"22\"] }\n// after\n{ reciprocal: true, assessorIds: [\"11\"], assesseeIds: [\"21\"] }","handlingStrategy":"validation","validationCode":"if (input.reciprocal && input.assesseeIds.length > 1) {\n  throw new Error('Reciprocal rules require exactly one assessee');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await createAllocationRules(input);\n} catch (e) {\n  if (e.message.includes('Only one assessee is allowed when creating reciprocal rules')) {\n    // split into one reciprocal call per pair\n  }\n}","preventionTips":["Cap assessee selection to 1 when reciprocal is on","Remember reciprocal does not fan out one assessor to many assessees","Split pairs into separate calls","Test forms after toggling rule modes"],"tags":["graphql","validation","reciprocal-rules","canvas"],"backgroundTag":"invalid-argument-value","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"}