vercel/ai · error · Error

HarnessAgent: pipeUIMessageStreamToResponse is not implement

Error message

HarnessAgent: pipeUIMessageStreamToResponse is not implemented yet. Track the foundation review for follow-up.

What it means

pipeUIMessageStreamToResponse on HarnessStreamTextResult is a stub that unconditionally throws this 'not implemented yet' error; the harness result does not yet support piping a UI message stream directly to a server Response. (pipeTextStreamToResponse is similarly unimplemented.) It is an intentional placeholder, not an environmental failure.

Source

Thrown at packages/harness/src/agent/internal/harness-stream-text-result.ts:763

      toUIMessageStreamHelper<TOOLS, UI_MESSAGE>({
        stream: this.stream,
        tools: this.tools,
        originalMessages,
        generateMessageId,
        onEnd,
        onFinish,
        messageMetadata,
        sendReasoning,
        sendSources,
        sendStart,
        sendFinish,
        onError,
      }),
    ) as AsyncIterableStream<InferUIMessageChunk<UI_MESSAGE>>;
  }

  pipeUIMessageStreamToResponse(): never {
    throw notSupportedYet('pipeUIMessageStreamToResponse');
  }

  pipeTextStreamToResponse(): never {
    throw notSupportedYet('pipeTextStreamToResponse');
  }

  toUIMessageStreamResponse<UI_MESSAGE extends UIMessage>({
    originalMessages,
    generateMessageId,
    onEnd,
    onFinish,
    messageMetadata,
    sendReasoning,
    sendSources,
    sendStart,
    sendFinish,
    onError,
    ...init

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Use result.toUIMessageStream() and write the chunks to your Response manually.
  2. Alternatively pipe result.textStream into a plain-text Response yourself.
  3. Track the foundation review; avoid calling this method until it is implemented.

Example fix

// before
result.pipeUIMessageStreamToResponse();
// after
const stream = result.toUIMessageStream({ onError });
return new Response(stream, { headers: { 'Content-Type': 'text/event-stream' } });
Defensive patterns

Strategy: fallback

Try / catch

// Avoid the stub entirely; build the response from the UI message stream:
const stream = result.toUIMessageStream({ onError });
return new Response(stream, { headers: { 'Content-Type': 'text/event-stream' } });

Prevention

When it happens

Trigger: Calling result.pipeUIMessageStreamToResponse() on any HarnessStreamTextResult — the method is `: never` and always throws.

Common situations: Porting route handlers from the core AI SDK useChat/server examples to a harness agent and calling the same pipe helper; expecting feature parity between `ai` result objects and harness results.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/b0bedbc475b9a0f0. Report an issue: GitHub.