vercel/ai · error · InvalidArgumentError

Anthropic batch request ID "${request.id}" must match ^[A-Za

Error message

Anthropic batch request ID "${request.id}" must match ^[A-Za-z0-9_-]{1,64}$.

What it means

Error "Anthropic batch request ID "${request.id}" must match ^[A-Za-z0-9_-]{1,64}$." thrown in vercel/ai.

Source

Thrown at packages/anthropic/src/anthropic-messages-batch.ts:429

          schema: anthropicBatchProviderOptionsSchema,
        })
      : undefined;

  const anthropicOptions = Object.assign(
    {},
    canonicalOptions ?? {},
    customOptions ?? {},
  );

  return anthropicOptions.anthropicBeta ?? [];
}

function validateRequestIds(requests: ReadonlyArray<AnthropicBatchRequest>) {
  const ids = new Set<string>();

  for (const request of requests) {
    if (!anthropicBatchRequestIdPattern.test(request.id)) {
      throw new InvalidArgumentError({
        argument: 'requests',
        message:
          `Anthropic batch request ID "${request.id}" must match ` +
          '^[A-Za-z0-9_-]{1,64}$.',
      });
    }

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

    ids.add(request.id);
  }
}

View on GitHub (pinned to 69428b1f8b)

When it happens

Trigger: Thrown at packages/anthropic/src/anthropic-messages-batch.ts:429 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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