vercel/ai · error · UnsupportedFunctionalityError

Anthropic Message Batches cannot decode the JSON-tool struct

Error message

Anthropic Message Batches cannot decode the JSON-tool structured-output fallback (request "${request.id}") because batch results are retrieved independently of the start call. Use a model that supports native output_format structured outputs.

What it means

Error "Anthropic Message Batches cannot decode the JSON-tool structured-output fallback (request "${request.id}") because batch results are retrieved independently of the start call. Use a model that supports native output_format structured outputs." thrown in vercel/ai.

Source

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

        providerOptions: request.options.providerOptions,
      });
      if (requestBetas.length > 0) {
        throw new UnsupportedFunctionalityError({
          functionality: 'per-request providerOptions.anthropic.anthropicBeta',
          message:
            `Anthropic Message Batches do not support per-request betas ` +
            `(request "${request.id}"). Set providerOptions.anthropic.anthropicBeta ` +
            `on startTextBatch instead.`,
        });
      }

      const prepared = await this.getArgs({
        ...request.options,
        stream: false,
        userSuppliedBetas: new Set(explicitBatchBetas),
      });
      if (prepared.usesJsonResponseTool) {
        throw new UnsupportedFunctionalityError({
          functionality: 'batch responseFormat JSON-tool fallback',
          message:
            `Anthropic Message Batches cannot decode the JSON-tool structured-output fallback ` +
            `(request "${request.id}") because batch results are retrieved independently of the start call. ` +
            `Use a model that supports native output_format structured outputs.`,
        });
      }
      const aliasedProviderTool = request.options.tools?.find(
        tool =>
          tool.type === 'provider' &&
          prepared.toolNameMapping.toProviderToolName(tool.name) !== tool.name,
      );
      if (aliasedProviderTool != null) {
        throw new UnsupportedFunctionalityError({
          functionality: 'aliased provider tool names in batches',
          message:
            `Anthropic Message Batches cannot restore the custom provider-tool name ` +
            `"${aliasedProviderTool.name}" when results are retrieved independently of the start call ` +

View on GitHub (pinned to 69428b1f8b)

When it happens

Trigger: Thrown at packages/anthropic/src/anthropic-messages-batch.ts:230 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/7ed0056ba0d9dafc. Report an issue: GitHub.