vercel/ai · error · InvalidArgumentError

Invalid argument for parameter requests: request IDs must be

Error message

Invalid argument for parameter requests: request IDs must be unique; duplicate ID "${request.id}"

What it means

The lifecycle state stores a digest of the authentication profile in effect when it was created. validateACPLifecycleCompatibility recomputes/compares it with the currently configured authenticationProfile and throws when the digests differ, because resuming a session under different credentials could act as a different principal.

Source

Thrown at packages/ai/src/batch/batch.ts:265

      parameter: 'requests',
      value: requests,
      message: 'requests must not be empty',
    });
  }

  const ids = new Set<string>();

  for (const request of requests) {
    if (request.id.trim().length === 0) {
      throw new InvalidArgumentError({
        parameter: 'requests',
        value: requests,
        message: 'request IDs must not be empty',
      });
    }

    if (ids.has(request.id)) {
      throw new InvalidArgumentError({
        parameter: 'requests',
        value: requests,
        message: `request IDs must be unique; duplicate ID "${request.id}"`,
      });
    }

    ids.add(request.id);
  }
}

function validateBatchReference({
  model,
  batch,
}: {
  model: BatchLanguageModelV4;
  batch: BatchReference;
}) {
  if (batch.version !== 1 || batch.type !== 'text') {

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Configure the same authentication profile (same credentials) that was used when the lifecycle state was captured.
  2. Restore the original credentials (e.g. check out the same env/API key) and retry.
  3. If credentials must change, start a new session rather than resuming the old lifecycle state.

Example fix

// before
createACPV1({ authenticationProfile: profileFor(process.env.NEW_API_KEY), lifecycle: state })

// after
createACPV1({ authenticationProfile: originalProfileUsedFor(state), lifecycle: state })
Defensive patterns

Strategy: validation

Validate before calling

if (lifecycleData.authenticationProfile?.digest !== authenticationProfile.digest) {
  throw new Error('Credentials changed; cannot resume lifecycle state');
}

Try / catch

try {
  harness = createACPV1({ authenticationProfile, lifecycle: state });
} catch (error) {
  if (error instanceof Error && error.message.includes('authentication profile')) {
    // credential mismatch: restore original credentials or start fresh
    harness = createACPV1({ lifecycle: undefined });
  } else {
    throw error;
  }
}

Prevention

When it happens

Trigger: Resuming ACP lifecycle state after the API key, auth token, or authentication profile configuration changed; rotating credentials between the original turn and the rerun; using a different account's credentials for the same session.

Common situations: Credential rotation policies that change keys mid-session; switching from a personal to a service-account key; CI running with a different secret than a developer's original session.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/788ab5300a92d4ce. Report an issue: GitHub.