{"record":{"id":"5e5d91884553faec","repo":"shadcn-ui/ui","slug":"no-assistant-response-found-for-this-transcript-5e5d91","errorCode":null,"errorMessage":"No assistant response found for this transcript.","messagePattern":"No assistant response found for this transcript\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/helpers/src/tanstack-ai/format.ts","lineNumber":309,"sourceCode":"    TanStackEventData,\n    TanStackToolSet<TOOLS>\n  >,\n  options: TurnStreamOptions\n): ConnectConnectionAdapter {\n  return {\n    connect(\n      messages: UIMessage[] | ModelMessage[],\n      _data?: Record<string, unknown>,\n      abortSignal?: AbortSignal,\n      runContext?: RunAgentInputContext\n    ) {\n      // The chat client hands custom adapters the full UIMessage history.\n      const turn = context.resolveTurn(\n        messages as ClientUIMessage<TOOLS, DATA>[]\n      )\n\n      if (!turn) {\n        throw new Error(\"No assistant response found for this transcript.\")\n      }\n\n      const encode = createRunEncoder<\n        TanStackEventData,\n        TanStackToolSet<TOOLS>\n      >({\n        threadId: runContext?.threadId ?? \"thread-chat\",\n        runId: runContext?.runId ?? \"run-chat\",\n        messageId: turn.message.id,\n      })\n      return streamToAsyncIterable(\n        context.streamTurn(turn, encode, options, abortSignal)\n      )\n    },\n  }\n}\n","sourceCodeStart":291,"sourceCodeEnd":326,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/helpers/src/tanstack-ai/format.ts#L291-L326","documentation":"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.","triggerScenarios":"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.","commonSituations":"TanStack-based demos with finite scripts; client reconnects once the conversation is done.","solutions":["Call context.resolveTurn(messages) before connect and handle undefined gracefully.","Stop the TanStack client once the transcript is exhausted.","Align message ids with scripted assistant turns."],"exampleFix":"// before\n// client auto-connects after exhaustion and throws\n\n// after\nconst turn = context.resolveTurn(messages as ClientUIMessage[])\nif (!turn) return // no scripted response; end the conversation","handlingStrategy":"validation","validationCode":"const turn = context.resolveTurn(messages as ClientUIMessage[])\nif (!turn) {\n  // no scripted response; return a terminal/empty stream instead of connecting\n  return\n}","typeGuard":"const hasMatchingTurn = (messages: unknown[]): boolean =>\n  Boolean(context.resolveTurn(messages as ClientUIMessage[]))","tryCatchPattern":"try {\n  await adapter.connect(messages, data, abortSignal, runContext)\n} catch (e) {\n  if ((e as Error).message === \"No assistant response found for this transcript.\") {\n    // gracefully end the conversation\n  } else throw e\n}","preventionTips":["Disable further sends once scripted turns are consumed.","Validate the message history shape before calling connect."],"tags":["tanstack","transcript","chat","transport"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}