vercel/ai · warning · Error
Method not implemented.
Error message
Method not implemented.
What it means
The LangChain transport adapter used by the AI SDK does not implement reconnectToStream; it unconditionally throws 'Method not implemented.' Reconnecting to a previously started stream is not supported for this transport, so calling it always fails by design rather than by bug.
Source
Thrown at packages/langchain/src/transport.ts:86
): Promise<ReadableStream<UIMessageChunk>> {
const baseMessages = await toBaseMessages(options.messages);
const stream = await this.graph.stream(
{ messages: baseMessages },
{ streamMode: ['values', 'messages'] },
);
return toUIMessageStream(
stream as AsyncIterable<AIMessageChunk> | ReadableStream,
);
}
async reconnectToStream(
_options: {
chatId: string;
} & ChatRequestOptions,
): Promise<ReadableStream<UIMessageChunk> | null> {
throw new Error('Method not implemented.');
}
}
View on GitHub (pinned to 69428b1f8b)
Solutions
- Do not call reconnectToStream with the LangChain transport; start a new request instead
- Persist messages yourself and re-send history as a new chat request after reload
- Wrap the call defensively and fall back to a fresh send when it throws
- Check for newer versions of @ai-sdk/langchain — reconnect support may have been added
Example fix
// before
const stream = await transport.reconnectToStream({ chatId });
// after
let stream = null;
try { stream = await transport.reconnectToStream({ chatId }); }
catch { stream = await transport.sendMessages({ chatId, messages: savedMessages }); } Defensive patterns
Strategy: fallback
Validate before calling
// detect unsupported reconnect capability before calling
if (!(transport as any).reconnectSupported) {
// skip reconnect path entirely
} Type guard
function supportsReconnect(t: unknown): boolean {
// LangChain transport always throws; treat reconnect as unsupported
return t instanceof ChatTransport && !(t instanceof LangChainTransport);
} Try / catch
let stream: ReadableStream<UIMessageChunk> | null = null;
try {
stream = await transport.reconnectToStream({ chatId });
} catch {
stream = await transport.sendMessages({ chatId, messages: savedMessages });
} Prevention
- Never rely on reconnect with the LangChain transport — persist messages and resend
- Feature-detect or document transport capabilities in your app
- Keep an eye on @ai-sdk/langchain releases for reconnect support
- Guard resume flows (e.g. after page reload) with try/catch plus a fresh-send fallback
When it happens
Trigger: Invoking reconnectToStream on a ChatTransport created from the LangChain adapter — typically after a page reload or dropped connection when trying to resume an ongoing chat stream.
Common situations: Using useChat's resume/reconnect feature with a LangChain-backed transport, or frameworks that call reconnectToStream automatically to restore interrupted conversations.
Related errors
- HarnessAgent: element streams in ${this.outputSpecification?
- HarnessAgent: pipeTextStreamToResponse is not implemented ye
- HarnessAgent: toTextStreamResponse is not implemented yet. T
- 'element streams in no-schema mode' functionality not suppor
- 'element streams in object mode' functionality not supported
AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30).
Data as JSON: /api/errors/340cf1a515ac60fe.
Report an issue: GitHub.