vercel/ai · error · InvalidArgumentError

Invalid argument for parameter schemaDescription: Schema des

Error message

Invalid argument for parameter schemaDescription: Schema description is not supported for no-schema output.

What it means

schemaDescription annotates a schema with a description sent to the provider for structured generation. With output: 'no-schema' there is no schema to describe, so the library throws InvalidArgumentError for schemaDescription instead of discarding it silently.

Source

Thrown at packages/ai/src/generate-object/validate-object-generation-input.ts:41

  ) {
    throw new InvalidArgumentError({
      parameter: 'output',
      value: output,
      message: 'Invalid output type.',
    });
  }

  if (output === 'no-schema') {
    if (schema != null) {
      throw new InvalidArgumentError({
        parameter: 'schema',
        value: schema,
        message: 'Schema is not supported for no-schema output.',
      });
    }

    if (schemaDescription != null) {
      throw new InvalidArgumentError({
        parameter: 'schemaDescription',
        value: schemaDescription,
        message: 'Schema description is not supported for no-schema output.',
      });
    }

    if (schemaName != null) {
      throw new InvalidArgumentError({
        parameter: 'schemaName',
        value: schemaName,
        message: 'Schema name is not supported for no-schema output.',
      });
    }

    if (enumValues != null) {
      throw new InvalidArgumentError({
        parameter: 'enumValues',
        value: enumValues,

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Remove schemaDescription from the call when using output: 'no-schema'.
  2. Fold the description text into the prompt so the model still receives the guidance.
  3. If structured output is intended, drop output: 'no-schema' so schemaDescription applies.

Example fix

// before
generateObject({ model, output: 'no-schema', schemaDescription: 'A user record', prompt });
// after
generateObject({ model, output: 'no-schema', prompt: 'A user record. ' + prompt });
Defensive patterns

Strategy: validation

Validate before calling

if (opts.output === 'no-schema' && opts.schemaDescription != null) {
  throw new Error("schemaDescription must be omitted when output is 'no-schema'");
}

Type guard

function hasNoSchemaDescription(opts) {
  return opts.output === 'no-schema' && opts.schemaDescription == null;
}

Try / catch

try {
  await generateObject(opts);
} catch (error) {
  if (InvalidArgumentError.isInstance(error) && error.parameter === 'schemaDescription') {
    const { schemaDescription, ...rest } = opts;
    return generateObject(rest);
  }
  throw error;
}

Prevention

When it happens

Trigger: Calling generateObject({ model, output: 'no-schema', schemaDescription: 'Some description', prompt }) or streamObject with the same combination; any non-null schemaDescription with no-schema output triggers it, with or without schema.

Common situations: Reusing a shared config object that carries schemaDescription after switching to no-schema output; copy-pasting a structured call and changing only output to no-schema; leaving schemaDescription in when migrating from schema-based to free-form generation.

Related errors


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