instructure/canvas-lms · error · GraphQL::ExecutionError

Only one assessee is allowed when rule applies to assessee

Error message

Only one assessee is allowed when rule applies to assessee

What it means

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.

Solutions

  1. Send exactly one assessee ID for a plain rule.
  2. Set reciprocal: true and split into per-pair calls if pairing multiple assessees is intended.
  3. Only pass appliesToAssessor/assessee-appropriate arrays for the chosen mode.
  4. Validate assesseeIds.length === 1 client-side before submission.

Example fix

// before
{ assessorIds: ["11"], assesseeIds: ["21", "22"] }
// after (two plain rules or a per-pair reciprocal call)
{ assessorIds: ["11"], assesseeIds: ["21"] }
{ assessorIds: ["11"], assesseeIds: ["22"] }
Defensive patterns

Strategy: validation

Validate before calling

if (!input.reciprocal && !input.appliesToAssessor && input.assesseeIds.length > 1) {
  throw new Error('Plain rules require exactly one assessee');
}

Try / catch

try {
  await createAllocationRules(input);
} catch (e) {
  if (e.message.includes('Only one assessee is allowed when rule applies to assessee')) {
    // submit one rule per assessee instead
  }
}

Prevention

When it happens

Trigger: Calling an allocation-rule create mutation with no reciprocal/appliesToAssessor flags and { assesseeIds: [x, y] } — assessee_ids.length > 1 in the final elsif branch.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/allocation_rule_base.rb:96

    def validate_id_arrays!(input)
      assessor_ids = input[:assessor_ids]
      assessee_ids = input[:assessee_ids]
      applies_to_assessor = input[:applies_to_assessor]
      reciprocal = input[:reciprocal]

      if reciprocal
        if assessor_ids.length > 1
          raise GraphQL::ExecutionError, I18n.t("Only one assessor is allowed when creating reciprocal rules")
        end
        if assessee_ids.length > 1
          raise GraphQL::ExecutionError, I18n.t("Only one assessee is allowed when creating reciprocal rules")
        end
      elsif applies_to_assessor
        if assessor_ids.length > 1
          raise GraphQL::ExecutionError, I18n.t("Only one assessor is allowed when rule applies to assessor")
        end
      elsif assessee_ids.length > 1
        raise GraphQL::ExecutionError, I18n.t("Only one assessee is allowed when rule applies to assessee")
      end

      if assessor_ids.empty?
        raise GraphQL::ExecutionError, I18n.t("At least one assessor is required")
      end
      if assessee_ids.empty?
        raise GraphQL::ExecutionError, I18n.t("At least one assessee is required")
      end

      if assessor_ids.length > 50
        raise GraphQL::ExecutionError, I18n.t("A maximum of 50 assessors can be provided at once")
      end
      if assessee_ids.length > 50
        raise GraphQL::ExecutionError, I18n.t("A maximum of 50 assessees can be provided at once")
      end
    end

    def get_assignment(assignment_id)

View on GitHub (pinned to 1c9f0bb801)