{"record":{"id":"1a0f32ea28d60eca","repo":"vercel/ai","slug":"harnessagent-structured-output-is-not-implemented","errorCode":null,"errorMessage":"HarnessAgent: structured output is not implemented yet. Track the foundation review for follow-up.","messagePattern":"HarnessAgent: structured output is not implemented yet\\. Track the foundation review for follow-up\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/harness/src/agent/internal/harness-stream-text-result.ts","lineNumber":705,"sourceCode":"    ) as AsyncIterableStream<InferStreamOutput<OUTPUT>>;\n  }\n\n  get elementStream(): AsyncIterableStream<InferElementOutput<OUTPUT>> {\n    const transform = this.outputSpecification?.createElementStreamTransform();\n    if (transform == null) {\n      throw notSupportedYet(\n        `element streams in ${this.outputSpecification?.name ?? 'text'} mode`,\n      );\n    }\n    return createAsyncIterableStream(\n      this.teeStream().pipeThrough(transform),\n    ) as AsyncIterableStream<InferElementOutput<OUTPUT>>;\n  }\n\n  get output(): Promise<InferGenerateOutput<OUTPUT>> {\n    return this.finalStep.then(step => {\n      if (this.outputSpecification == null) {\n        throw notSupportedYet('structured output');\n      }\n      return this.outputSpecification.parseCompleteOutput(\n        { text: step.text },\n        {\n          response: step.response,\n          usage: step.usage,\n          finishReason: step.finishReason,\n        },\n      );\n    });\n  }\n\n  async consumeStream(): Promise<void> {\n    const reader = this.fullStream.getReader();\n    try {\n      while (true) {\n        const { done } = await reader.read();\n        if (done) return;","sourceCodeStart":687,"sourceCodeEnd":723,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness/src/agent/internal/harness-stream-text-result.ts#L687-L723","documentation":"The `output` getter on HarnessStreamTextResult is supposed to return the parsed, structured output of the final step, but structured output requires an outputSpecification on the harness agent. When none is configured (plain text mode), it throws this explicit 'not implemented yet' error pointing to the foundation review tracker.","triggerScenarios":"Awaiting result.output on a HarnessStreamTextResult created without an outputSpecification (the check `this.outputSpecification == null` inside the finalStep resolution).","commonSituations":"Migrating generateObject-style code to the harness agent which only ran streamText in text mode; forgetting to pass a schema/outputSpecification to the harness agent constructor.","solutions":["Read result.text (via the final step or textStream) and parse it yourself in text mode.","Provide an outputSpecification (schema-backed output mode) when creating the harness agent, then await result.output.","Track the foundation review for structured output support landing in the harness package."],"exampleFix":"// before\nconst data = await result.output;\n// after\nconst text = (await result.finalStep).text;\nconst data = JSON.parse(text); // or configure an outputSpecification","handlingStrategy":"validation","validationCode":"if (result.outputSpecification == null) {\n  // text mode: do not call result.output\n}","typeGuard":null,"tryCatchPattern":"let output;\ntry {\n  output = await result.output;\n} catch {\n  output = parseJsonSafe((await result.finalStep).text);\n}","preventionTips":["Pass an outputSpecification when the agent must return structured data.","Treat result.output as unavailable in text-mode harness agents.","Follow the harness package release notes for structured-output support."],"tags":["not-implemented","structured-output","harness-agent","api-limitation"],"backgroundTag":"feature-not-implemented","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}