{"record":{"id":"a7b29dfc4e67731a","repo":"eyaltoledano/claude-task-master","slug":"schema-is-required-for-object-streaming","errorCode":null,"errorMessage":"Schema is required for object streaming","messagePattern":"Schema is required for object streaming","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/ai-providers/base-provider.js","lineNumber":434,"sourceCode":"\t\t\t\t`${this.name} streamText initiated successfully for model: ${params.modelId}`\n\t\t\t);\n\n\t\t\treturn stream;\n\t\t} catch (error) {\n\t\t\tthis.handleError('text streaming', error);\n\t\t}\n\t}\n\n\t/**\n\t * Streams a structured object using the provider's model\n\t */\n\tasync streamObject(params) {\n\t\ttry {\n\t\t\tthis.validateParams(params);\n\t\t\tthis.validateMessages(params.messages);\n\n\t\t\tif (!params.schema) {\n\t\t\t\tthrow new Error('Schema is required for object streaming');\n\t\t\t}\n\n\t\t\tlog(\n\t\t\t\t'debug',\n\t\t\t\t`Streaming ${this.name} object with model: ${params.modelId}`\n\t\t\t);\n\n\t\t\tconst client = await this.getClient(params);\n\n\t\t\t// Get Sentry telemetry config with function ID and metadata for better tracing\n\t\t\t// Format: provider.model.command.method\n\t\t\tconst commandName = params.commandName || 'unknown';\n\t\t\tconst functionId = `${this.name}.${params.modelId}.${commandName}.streamObject`;\n\n\t\t\t// Build telemetry metadata for enhanced filtering/grouping in Sentry\n\t\t\tconst metadata = {\n\t\t\t\tcommand: commandName,\n\t\t\t\toutputType: params.outputType,","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/eyaltoledano/claude-task-master/blob/c0c98d367c55296bfe69e65680625b6db437af02/src/ai-providers/base-provider.js#L416-L452","documentation":"BaseAIProvider.streamObject generates structured objects from a streaming model response and therefore requires a Zod/schema definition describing the object shape. If params.schema is missing/falsy after param and message validation pass, this error is thrown before any API call is made.","triggerScenarios":"Calling provider.streamObject({ modelId, messages }) without a schema property, or with schema set to null/undefined (e.g. a variable that failed to initialize).","commonSituations":"Conditionally building params and dropping the schema; migrating from a text-generation call to streamObject and forgetting the schema; dynamically imported schema module returning undefined.","solutions":["Pass a valid schema (e.g. a Zod object schema) in the schema field of the params","Verify the schema variable is defined before the call (log or assert it)","If you don't need structured output, use streamText instead"],"exampleFix":"// before\nawait provider.streamObject({ modelId: 'x', messages });\n// after\nimport { z } from 'zod';\nawait provider.streamObject({ modelId: 'x', messages, schema: z.object({ name: z.string() }) });","handlingStrategy":"validation","validationCode":"function assertStreamObjectParams(params) {\n  if (!params?.schema) throw new Error('streamObject requires params.schema (e.g. a z.object schema)');\n}","typeGuard":"function hasSchema(params) {\n  return typeof params === 'object' && params !== null && params.schema != null;\n}","tryCatchPattern":"try {\n  await provider.streamObject(params);\n} catch (e) {\n  if (e.message === 'Schema is required for object streaming') {\n    console.error('params.schema missing; pass a Zod schema');\n  } else throw e;\n}","preventionTips":["Define schemas next to the call site so they are never conditionally omitted","Assert schema presence in the function that builds the params","Use streamText when no structured output is needed"],"tags":["validation","schema","streaming"],"backgroundTag":"missing-required-parameter","analyzedSha":"c0c98d367c55296bfe69e65680625b6db437af02","analyzedAt":"2026-08-29T02:56:26.071Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}