shadcn-ui/ui · error

No assistant response found for this transcript.

Error message

No assistant response found for this transcript.

What it means

The TanStack AI connection adapter's connect() calls context.resolveTurn(messages); if no scripted assistant turn matches the UIMessage/ModelMessage history, it throws. This is the same root cause as the AI SDK variant (error 7) but reached through the TanStack connect lifecycle.

Source

Thrown at packages/helpers/src/tanstack-ai/format.ts:309

    TanStackEventData,
    TanStackToolSet<TOOLS>
  >,
  options: TurnStreamOptions
): ConnectConnectionAdapter {
  return {
    connect(
      messages: UIMessage[] | ModelMessage[],
      _data?: Record<string, unknown>,
      abortSignal?: AbortSignal,
      runContext?: RunAgentInputContext
    ) {
      // The chat client hands custom adapters the full UIMessage history.
      const turn = context.resolveTurn(
        messages as ClientUIMessage<TOOLS, DATA>[]
      )

      if (!turn) {
        throw new Error("No assistant response found for this transcript.")
      }

      const encode = createRunEncoder<
        TanStackEventData,
        TanStackToolSet<TOOLS>
      >({
        threadId: runContext?.threadId ?? "thread-chat",
        runId: runContext?.runId ?? "run-chat",
        messageId: turn.message.id,
      })
      return streamToAsyncIterable(
        context.streamTurn(turn, encode, options, abortSignal)
      )
    },
  }
}

View on GitHub (pinned to efac598707)

Solutions

  1. Call context.resolveTurn(messages) before connect and handle undefined gracefully.
  2. Stop the TanStack client once the transcript is exhausted.
  3. Align message ids with scripted assistant turns.

Example fix

// before
// client auto-connects after exhaustion and throws

// after
const turn = context.resolveTurn(messages as ClientUIMessage[])
if (!turn) return // no scripted response; end the conversation
Defensive patterns

Strategy: validation

Validate before calling

const turn = context.resolveTurn(messages as ClientUIMessage[])
if (!turn) {
  // no scripted response; return a terminal/empty stream instead of connecting
  return
}

Type guard

const hasMatchingTurn = (messages: unknown[]): boolean =>
  Boolean(context.resolveTurn(messages as ClientUIMessage[]))

Try / catch

try {
  await adapter.connect(messages, data, abortSignal, runContext)
} catch (e) {
  if ((e as Error).message === "No assistant response found for this transcript.") {
    // gracefully end the conversation
  } else throw e
}

Prevention

When it happens

Trigger: A TanStack chat client sending a message after the scripted transcript is exhausted; a message history that does not align with scripted turns; reconnecting after completion.

Common situations: TanStack-based demos with finite scripts; client reconnects once the conversation is done.

Related errors


AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12). Data as JSON: /api/errors/5e5d91884553faec. Report an issue: GitHub.