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

Cannot set # in the parent assignment for checkpoints.

Error message

Cannot set #{key} in the parent assignment for checkpoints.

What it means

When for_checkpoints is true, validate_for_checkpoints forbids setting points_possible, due_at, lock_at, or unlock_at on the parent assignment — those live on the checkpoint sub-assignments. Setting any of these keys raises with the offending key name.

Solutions

  1. Omit points_possible/due_at/lock_at/unlock_at from the input when forCheckpoints is true.
  2. Set those values on each checkpoint sub-assignment instead of the parent.
  3. Adjust client to conditionally build the input hash based on checkpoint mode.
  4. Ensure the form doesn't include keys with nil values — presence of the key alone triggers the error.

Example fix

// before
updateAssignment(input: { id, forCheckpoints: true, dueAt: "2026-09-01", pointsPossible: 10 })

// after
updateAssignment(input: { id, forCheckpoints: true })
// due/points set per checkpoint sub-assignment
Defensive patterns

Strategy: validation

Validate before calling

const restricted = ['pointsPossible','dueAt','lockAt','unlockAt']
if (input.forCheckpoints && restricted.some(k => k in input))
  throw new Error('restricted field set on checkpoint parent')

Try / catch

try {
  await updateAssignment(input)
} catch (e) {
  if (e.message.startsWith('Cannot set')) stripRestrictedKeysAndRetry()
}

Prevention

When it happens

Trigger: A createAssignment/updateAssignment mutation with forCheckpoints: true and any of pointsPossible, dueAt, lockAt, or unlockAt present in the input (even null-keyed via input_hash.key?).

Common situations: Clients always serializing full assignment payloads (including nil dates) when editing checkpoint parents; copy-paste of non-checkpoint mutation payloads; form UIs submitting every field regardless of mode.

Related errors


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

Appendix: source

Thrown at app/graphql/mutations/assignment_base.rb:334

    end
  end

  def ensure_restored
    # if we are already not destroyed, then dont do anything
    return if @working_assignment.workflow_state != "deleted"
    raise GraphQL::ExecutionError, "insufficient permission" unless @working_assignment.grants_right? current_user, :delete

    @working_assignment.restore
  end

  def validate_for_checkpoints(input_hash)
    return unless input_hash[:for_checkpoints]

    restricted_keys = %i[points_possible due_at lock_at unlock_at].freeze

    restricted_keys.each do |key|
      if input_hash.key?(key)
        raise GraphQL::ExecutionError, "Cannot set #{key} in the parent assignment for checkpoints."
      end
    end
  end
end

View on GitHub (pinned to 1c9f0bb801)