{"record":{"id":"487ca96a14d3be36","repo":"vercel/ai","slug":"invalid-argument-for-parameter-schemadescription","errorCode":null,"errorMessage":"Invalid argument for parameter schemaDescription: Schema description is not supported for no-schema output.","messagePattern":"Invalid argument for parameter schemaDescription: Schema description 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":41,"sourceCode":"  ) {\n    throw new InvalidArgumentError({\n      parameter: 'output',\n      value: output,\n      message: 'Invalid output type.',\n    });\n  }\n\n  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,","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/ai/src/generate-object/validate-object-generation-input.ts#L23-L59","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove schemaDescription from the call when using output: 'no-schema'.","Fold the description text into the prompt so the model still receives the guidance.","If structured output is intended, drop output: 'no-schema' so schemaDescription applies."],"exampleFix":"// before\ngenerateObject({ model, output: 'no-schema', schemaDescription: 'A user record', prompt });\n// after\ngenerateObject({ model, output: 'no-schema', prompt: 'A user record. ' + prompt });","handlingStrategy":"validation","validationCode":"if (opts.output === 'no-schema' && opts.schemaDescription != null) {\n  throw new Error(\"schemaDescription must be omitted when output is 'no-schema'\");\n}","typeGuard":"function hasNoSchemaDescription(opts) {\n  return opts.output === 'no-schema' && opts.schemaDescription == null;\n}","tryCatchPattern":"try {\n  await generateObject(opts);\n} catch (error) {\n  if (InvalidArgumentError.isInstance(error) && error.parameter === 'schemaDescription') {\n    const { schemaDescription, ...rest } = opts;\n    return generateObject(rest);\n  }\n  throw error;\n}","preventionTips":["Move descriptive text into the prompt instead of schemaDescription when output is free-form.","Validate options objects before dispatching generateObject/streamObject calls.","Keep schema-related options in one conditional block of your request builder."],"tags":["invalid-argument","schema-description","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"}