{"record":{"id":"418d80de2da5d9b9","repo":"vercel/ai","slug":"harnessagent-pipetextstreamtoresponse-is-not-impl","errorCode":null,"errorMessage":"HarnessAgent: pipeTextStreamToResponse is not implemented yet. Track the foundation review for follow-up.","messagePattern":"HarnessAgent: pipeTextStreamToResponse 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":767,"sourceCode":"        generateMessageId,\n        onEnd,\n        onFinish,\n        messageMetadata,\n        sendReasoning,\n        sendSources,\n        sendStart,\n        sendFinish,\n        onError,\n      }),\n    ) as AsyncIterableStream<InferUIMessageChunk<UI_MESSAGE>>;\n  }\n\n  pipeUIMessageStreamToResponse(): never {\n    throw notSupportedYet('pipeUIMessageStreamToResponse');\n  }\n\n  pipeTextStreamToResponse(): never {\n    throw notSupportedYet('pipeTextStreamToResponse');\n  }\n\n  toUIMessageStreamResponse<UI_MESSAGE extends UIMessage>({\n    originalMessages,\n    generateMessageId,\n    onEnd,\n    onFinish,\n    messageMetadata,\n    sendReasoning,\n    sendSources,\n    sendStart,\n    sendFinish,\n    onError,\n    ...init\n  }: ResponseInit & {\n    consumeSseStream?: (options: {\n      stream: ReadableStream<string>;\n    }) => PromiseLike<void> | void;","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/vercel/ai/blob/69428b1f8b037e4d118fb4853428d5c4e620493c/packages/harness/src/agent/internal/harness-stream-text-result.ts#L749-L785","documentation":"HarnessStreamTextResult.pipeTextStreamToResponse is a stub that intentionally throws because the harness package has not implemented HTTP Response piping for text streams. The SDK throws this eagerly so callers get a clear 'not supported yet' error instead of silent undefined behavior while the foundation is under review. It is a temporary placeholder, not an operational failure.","triggerScenarios":"Calling result.pipeTextStreamToResponse() on the object returned by a HarnessAgent streamText run in packages/harness; every invocation throws immediately since the method body is `throw notSupportedYet('pipeTextStreamToResponse')`.","commonSituations":"Migrating server code that used the standard AI SDK StreamTextResult (e.g. a Next.js route returning the response) to a harness-based agent; copying examples built on streamText from `ai` and running them against HarnessAgent before checking the harness API surface.","solutions":["Do not call pipeTextStreamToResponse on HarnessStreamTextResult; read the stream yourself via result.textStream and build the Response manually (e.g. new Response(result.textStream, { headers: { 'content-type': 'text/plain; charset=utf-8' } })).","Use toTextStreamResponse replacement pattern: pipe the textStream through a TransformStream into a Response in your route handler.","Track the harness foundation review follow-up referenced in the error message and upgrade the package when the method ships.","If you need full response piping today, use the core `ai` package streamText result instead of HarnessAgent for that endpoint."],"exampleFix":"// before\nconst result = await agent.stream({ prompt });\nreturn result.pipeTextStreamToResponse();\n// after\nconst result = await agent.stream({ prompt });\nreturn new Response(result.textStream, {\n  headers: { 'content-type': 'text/plain; charset=utf-8' },\n});","handlingStrategy":"fallback","validationCode":"if (typeof (result as any).pipeTextStreamToResponse !== 'function' || HarnessStreamTextResultNotImplemented) { /* use manual Response construction */ }","typeGuard":"function supportsPipeTextStream(result: unknown): boolean {\n  return typeof result === 'object' && result !== null &&\n    typeof (result as { pipeTextStreamToResponse?: unknown }).pipeTextStreamToResponse === 'function';\n}","tryCatchPattern":null,"preventionTips":["Check the HarnessAgent API surface (docs/types) before porting code that uses ai-package StreamTextResult methods.","Build responses manually from textStream/UIMessageStream so the code does not depend on not-yet-implemented convenience methods.","Add a thin adapter module for harness results so future implementations require only one change.","Pin and monitor harness package releases for the foundation-review follow-up that lands these methods."],"tags":["not-implemented","harness","streaming","api-surface"],"backgroundTag":"method-not-implemented","analyzedSha":"69428b1f8b037e4d118fb4853428d5c4e620493c","analyzedAt":"2026-08-30T12:32:21.016Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}