vercel/ai · error · Error
HarnessAgent: structured output is not implemented yet. Trac
Error message
HarnessAgent: structured output is not implemented yet. Track the foundation review for follow-up.
What it means
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.
Source
Thrown at packages/harness/src/agent/internal/harness-stream-text-result.ts:705
) as AsyncIterableStream<InferStreamOutput<OUTPUT>>;
}
get elementStream(): AsyncIterableStream<InferElementOutput<OUTPUT>> {
const transform = this.outputSpecification?.createElementStreamTransform();
if (transform == null) {
throw notSupportedYet(
`element streams in ${this.outputSpecification?.name ?? 'text'} mode`,
);
}
return createAsyncIterableStream(
this.teeStream().pipeThrough(transform),
) as AsyncIterableStream<InferElementOutput<OUTPUT>>;
}
get output(): Promise<InferGenerateOutput<OUTPUT>> {
return this.finalStep.then(step => {
if (this.outputSpecification == null) {
throw notSupportedYet('structured output');
}
return this.outputSpecification.parseCompleteOutput(
{ text: step.text },
{
response: step.response,
usage: step.usage,
finishReason: step.finishReason,
},
);
});
}
async consumeStream(): Promise<void> {
const reader = this.fullStream.getReader();
try {
while (true) {
const { done } = await reader.read();
if (done) return;View on GitHub (pinned to 69428b1f8b)
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.
Example fix
// before const data = await result.output; // after const text = (await result.finalStep).text; const data = JSON.parse(text); // or configure an outputSpecification
Defensive patterns
Strategy: validation
Validate before calling
if (result.outputSpecification == null) {
// text mode: do not call result.output
} Try / catch
let output;
try {
output = await result.output;
} catch {
output = parseJsonSafe((await result.finalStep).text);
} Prevention
- 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.
When it happens
Trigger: Awaiting result.output on a HarnessStreamTextResult created without an outputSpecification (the check `this.outputSpecification == null` inside the finalStep resolution).
Common situations: 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.
Related errors
- HarnessAgent: element streams in ${this.outputSpecification?
- HarnessAgent: pipeUIMessageStreamToResponse is not implement
- No object generated: could not parse the response.
- No object generated: response did not match schema.
- No object generated: could not parse the response.
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/1a0f32ea28d60eca.
Report an issue: GitHub.