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

Only one assessee is allowed when creating reciprocal rules

Error message

Only one assessee is allowed when creating reciprocal rules

What it means

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.

Solutions

  1. Send exactly one assessee ID when reciprocal: true.
  2. Create separate mutation calls for each reciprocal pair.
  3. Drop reciprocal: true if multiple assessees per assessor are intended.
  4. Guard the UI so reciprocal mode disables multi-select for both lists.

Example fix

// before
{ reciprocal: true, assessorIds: ["11"], assesseeIds: ["21", "22"] }
// after
{ reciprocal: true, assessorIds: ["11"], assesseeIds: ["21"] }
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

try {
  await createAllocationRules(input);
} catch (e) {
  if (e.message.includes('Only one assessee is allowed when creating reciprocal rules')) {
    // split into one reciprocal call per pair
  }
}

Prevention

When it happens

Trigger: Calling an allocation-rule create mutation with input { reciprocal: true, assessorIds: [one-id], assesseeIds: [x, y] } — assessee_ids.length > 1 while reciprocal is set.

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

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/e863fa24e35e0a18. Report an issue: GitHub.

Appendix: source

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

    def validate_feature_flag!(course)
      unless course.feature_enabled?(:peer_review_allocation_and_grading)
        raise GraphQL::ExecutionError, I18n.t("peer_review_allocation_and_grading feature flag is not enabled for this course")
      end
    end

    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")

View on GitHub (pinned to 1c9f0bb801)