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

  1. Do not call reconnectToStream with the LangChain transport; start a new request instead
  2. Persist messages yourself and re-send history as a new chat request after reload
  3. Wrap the call defensively and fall back to a fresh send when it throws
  4. 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

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


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