vercel/ai · error · InvalidArgumentError
Invalid argument for parameter schemaName: Schema name is no
Error message
Invalid argument for parameter schemaName: Schema name is not supported for no-schema output.
What it means
schemaName names the schema (used e.g. as the OpenAI function/structured-output name). For output: 'no-schema' no schema exists, so passing schemaName is contradictory and the library throws InvalidArgumentError.
Source
Thrown at packages/ai/src/generate-object/validate-object-generation-input.ts:49
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,
message: 'Enum values are not supported for no-schema output.',
});
}
}
if (output === 'object') {
if (schema == null) {
throw new InvalidArgumentError({View on GitHub (pinned to 69428b1f8b)
Solutions
- Remove schemaName from the call when using output: 'no-schema'.
- If you need a named structured output, use output: 'object' with schema and schemaName.
- Centralize no-schema calls in a helper that omits schema-related options entirely.
Example fix
// before
generateObject({ model, output: 'no-schema', schemaName: 'UserObject', prompt });
// after
generateObject({ model, output: 'no-schema', prompt }); Defensive patterns
Strategy: validation
Validate before calling
if (opts.output === 'no-schema' && opts.schemaName != null) {
throw new Error("schemaName must be omitted when output is 'no-schema'");
} Type guard
function isCleanNoSchemaOptions(opts) {
return opts.output === 'no-schema'
&& opts.schema == null
&& opts.schemaName == null
&& opts.schemaDescription == null;
} Try / catch
try {
await generateObject(opts);
} catch (error) {
if (InvalidArgumentError.isInstance(error) && error.parameter === 'schemaName') {
const { schemaName, ...rest } = opts;
return generateObject(rest);
}
throw error;
} Prevention
- Only set schemaName together with a schema for object/array output.
- Write a small options sanitizer for no-schema calls.
- Lint your call sites for output: 'no-schema' combined with schema* options.
When it happens
Trigger: Calling generateObject({ model, output: 'no-schema', schemaName: 'MyObject', prompt }) or streamObject with schemaName set alongside no-schema output.
Common situations: Shared request-builder helper that always sets schemaName; migrating calls between object and no-schema modes without pruning schema-related options; template code copied from a schema-based example.
Related errors
- Invalid argument for parameter schema: Schema is not support
- Invalid argument for parameter schemaDescription: Schema des
- Invalid argument for parameter enumValues: Enum values are n
- Invalid argument for parameter schema: Schema is required fo
- Invalid argument for parameter enumValues: Enum values are n
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/0d406dda43cc0a00.
Report an issue: GitHub.