vercel/ai · error · InvalidArgumentError
Invalid argument for parameter schemaDescription: Schema des
Error message
Invalid argument for parameter schemaDescription: Schema description is not supported for enum output.
What it means
schemaDescription annotates a schema, but output: 'enum' uses enumValues rather than a schema, so there is nothing to describe. The library throws InvalidArgumentError for schemaDescription when output is 'enum'.
Source
Thrown at packages/ai/src/generate-object/validate-object-generation-input.ts:111
throw new InvalidArgumentError({
parameter: 'enumValues',
value: enumValues,
message: 'Enum values are not supported for array output.',
});
}
}
if (output === 'enum') {
if (schema != null) {
throw new InvalidArgumentError({
parameter: 'schema',
value: schema,
message: 'Schema is not supported for enum output.',
});
}
if (schemaDescription != null) {
throw new InvalidArgumentError({
parameter: 'schemaDescription',
value: schemaDescription,
message: 'Schema description is not supported for enum output.',
});
}
if (schemaName != null) {
throw new InvalidArgumentError({
parameter: 'schemaName',
value: schemaName,
message: 'Schema name is not supported for enum output.',
});
}
if (enumValues == null) {
throw new InvalidArgumentError({
parameter: 'enumValues',
value: enumValues,View on GitHub (pinned to 69428b1f8b)
Solutions
- Remove schemaDescription when using output: 'enum'.
- Explain the enum values in the prompt if additional guidance is needed.
- Attach schemaDescription only for object/array output where a schema is used.
Example fix
// before
generateObject({ model, output: 'enum', enumValues: ['a','b'], schemaDescription: 'Pick a letter', prompt });
// after
generateObject({ model, output: 'enum', enumValues: ['a','b'], prompt: 'Pick a letter. ' + prompt }); Defensive patterns
Strategy: validation
Validate before calling
if (opts.output === 'enum' && opts.schemaDescription != null) {
throw new Error("schemaDescription must be omitted when output is 'enum'");
} Type guard
function isEnumOptionsClean(opts) {
return opts.output !== 'enum'
|| (opts.schema == null
&& opts.schemaDescription == null
&& opts.schemaName == null);
} Try / catch
try {
return await generateObject(opts);
} catch (error) {
if (InvalidArgumentError.isInstance(error) && error.parameter === 'schemaDescription') {
const { schemaDescription, ...rest } = opts;
return generateObject(rest);
}
throw error;
} Prevention
- Only attach schemaDescription alongside an actual schema (object/array output).
- Put extra guidance for enum picking into the prompt.
- Sanitize options before calling generateObject/streamObject in generic wrappers.
When it happens
Trigger: Calling generateObject({ model, output: 'enum', enumValues: [...], schemaDescription: '...', prompt }) or streamObject with the same; any non-null schemaDescription with enum output triggers it.
Common situations: Generic call builder that always sets schemaDescription; converting an object-output call to enum output without pruning schema-related options; configuration driven from user input that carries stale options.
Related errors
- Invalid argument for parameter schemaDescription: Schema des
- Invalid argument for parameter schema: Schema is not support
- Invalid argument for parameter schema: Schema is not support
- Invalid argument for parameter schemaName: Schema name is no
- Invalid argument for parameter enumValues: Enum values are n
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/c91c7346cc388462.
Report an issue: GitHub.