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

Only one assessor is allowed when rule applies to assessor

Error message

Only one assessor is allowed when rule applies to assessor

What it means

Raised by validate_id_arrays! in AllocationRuleBase when applies_to_assessor is true (and the rule is not reciprocal) but assessor_ids contains more than one ID. In this mode the rule applies to a specific single assessor, so multiple assessors are rejected with a GraphQL ExecutionError.

Solutions

  1. Send exactly one assessor ID when appliesToAssessor: true.
  2. Remove appliesToAssessor if a multi-assessor rule is intended.
  3. Clear/limit the assessor selection in the UI when this rule mode is chosen.
  4. Client-side validate assessorIds.length === 1 before sending.

Example fix

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

Strategy: validation

Validate before calling

if (input.appliesToAssessor && input.assessorIds.length > 1) {
  throw new Error('appliesToAssessor rules require exactly one assessor');
}

Try / catch

try {
  await createAllocationRules(input);
} catch (e) {
  if (e.message.includes('Only one assessor is allowed when rule applies to assessor')) {
    // clear extra assessors or drop appliesToAssessor and retry
  }
}

Prevention

When it happens

Trigger: Calling an allocation-rule create mutation with { appliesToAssessor: true, assessorIds: [id1, id2], ... } — non-reciprocal branch, applies_to_assessor true, assessor_ids.length > 1.

Common situations: Reusing a bulk-assignment payload while switching the rule mode to applies-to-assessor; a form retains multiple selected assessors after the user toggles the rule type; copy-pasting between mutation variants without trimming the ID arrays.

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

Appendix: source

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

      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")
      end
      if assessee_ids.length > 50
        raise GraphQL::ExecutionError, I18n.t("A maximum of 50 assessees can be provided at once")
      end

View on GitHub (pinned to 1c9f0bb801)