{"record":{"id":"26ce10325bbdf867","repo":"instructure/canvas-lms","slug":"only-one-assessee-is-allowed-when-rule-applies-to-assessee","errorCode":null,"errorMessage":"Only one assessee is allowed when rule applies to assessee","messagePattern":"Only one assessee is allowed when rule applies to assessee","errorType":"exception","errorClass":"GraphQL::ExecutionError","httpStatus":null,"severity":"error","filePath":"app/graphql/mutations/allocation_rule_base.rb","lineNumber":96,"sourceCode":"    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\")\n      end\n      if assessee_ids.length > 50\n        raise GraphQL::ExecutionError, I18n.t(\"A maximum of 50 assessees can be provided at once\")\n      end\n    end\n\n    def get_assignment(assignment_id)","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/instructure/canvas-lms/blob/1c9f0bb8013ed69c4f2efe11fd483025469b7e6c/app/graphql/mutations/allocation_rule_base.rb#L78-L114","documentation":"Raised by validate_id_arrays! in AllocationRuleBase when the input is not reciprocal, does not apply to assessor, and assessee_ids contains more than one ID (the default branch). In the plain rule mode the rule targets a single assessee, so multiple assessees are rejected with a GraphQL ExecutionError.","triggerScenarios":"Calling an allocation-rule create mutation with no reciprocal/appliesToAssessor flags and { assesseeIds: [x, y] } — assessee_ids.length > 1 in the final elsif branch.","commonSituations":"Multi-selecting students in a plain (non-reciprocal, non-assessor-scoped) rule form; a shared mutation helper passes through every selected ID regardless of rule mode; migrating from a bulk workflow to the single-assessee rule type.","solutions":["Send exactly one assessee ID for a plain rule.","Set reciprocal: true and split into per-pair calls if pairing multiple assessees is intended.","Only pass appliesToAssessor/assessee-appropriate arrays for the chosen mode.","Validate assesseeIds.length === 1 client-side before submission."],"exampleFix":"// before\n{ assessorIds: [\"11\"], assesseeIds: [\"21\", \"22\"] }\n// after (two plain rules or a per-pair reciprocal call)\n{ assessorIds: [\"11\"], assesseeIds: [\"21\"] }\n{ assessorIds: [\"11\"], assesseeIds: [\"22\"] }","handlingStrategy":"validation","validationCode":"if (!input.reciprocal && !input.appliesToAssessor && input.assesseeIds.length > 1) {\n  throw new Error('Plain 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 rule applies to assessee')) {\n    // submit one rule per assessee instead\n  }\n}","preventionTips":["Restrict plain-rule forms to single assessee selection","Loop per-assessee to create multiple rules","Validate all mode/array combinations client-side","Document that bulk selection only applies to the 50-cap non-scoped paths"],"tags":["graphql","validation","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"}