{"record":{"id":"0d406dda43cc0a00","repo":"vercel/ai","slug":"invalid-argument-for-parameter-schemaname-schema","errorCode":null,"errorMessage":"Invalid argument for parameter schemaName: Schema name is not supported for no-schema output.","messagePattern":"Invalid argument for parameter schemaName: Schema name is not supported for no-schema output\\.","errorType":"validation","errorClass":"InvalidArgumentError","httpStatus":null,"severity":"error","filePath":"packages/ai/src/generate-object/validate-object-generation-input.ts","lineNumber":49,"sourceCode":"  if (output === 'no-schema') {\n    if (schema != null) {\n      throw new InvalidArgumentError({\n        parameter: 'schema',\n        value: schema,\n        message: 'Schema is not supported for no-schema output.',\n      });\n    }\n\n    if (schemaDescription != null) {\n      throw new InvalidArgumentError({\n        parameter: 'schemaDescription',\n        value: schemaDescription,\n        message: 'Schema description is not supported for no-schema output.',\n      });\n    }\n\n    if (schemaName != null) {\n      throw new InvalidArgumentError({\n        parameter: 'schemaName',\n        value: schemaName,\n        message: 'Schema name is not supported for no-schema output.',\n      });\n    }\n\n    if (enumValues != null) {\n      throw new InvalidArgumentError({\n        parameter: 'enumValues',\n        value: enumValues,\n        message: 'Enum values are not supported for no-schema output.',\n      });\n    }\n  }\n\n  if (output === 'object') {\n    if (schema == null) {\n      throw new InvalidArgumentError({","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/ai/src/generate-object/validate-object-generation-input.ts#L31-L67","documentation":"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.","triggerScenarios":"Calling generateObject({ model, output: 'no-schema', schemaName: 'MyObject', prompt }) or streamObject with schemaName set alongside no-schema output.","commonSituations":"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.","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."],"exampleFix":"// before\ngenerateObject({ model, output: 'no-schema', schemaName: 'UserObject', prompt });\n// after\ngenerateObject({ model, output: 'no-schema', prompt });","handlingStrategy":"validation","validationCode":"if (opts.output === 'no-schema' && opts.schemaName != null) {\n  throw new Error(\"schemaName must be omitted when output is 'no-schema'\");\n}","typeGuard":"function isCleanNoSchemaOptions(opts) {\n  return opts.output === 'no-schema'\n    && opts.schema == null\n    && opts.schemaName == null\n    && opts.schemaDescription == null;\n}","tryCatchPattern":"try {\n  await generateObject(opts);\n} catch (error) {\n  if (InvalidArgumentError.isInstance(error) && error.parameter === 'schemaName') {\n    const { schemaName, ...rest } = opts;\n    return generateObject(rest);\n  }\n  throw error;\n}","preventionTips":["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."],"tags":["invalid-argument","schema-name","no-schema","input-validation"],"backgroundTag":"incompatible-schema-option","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}