{"record":{"id":"ec6d6be46dca965e","repo":"shadcn-ui/ui","slug":"get-cannot-materialize-a-continuation-turn-witho","errorCode":null,"errorMessage":"get() cannot materialize a continuation turn without a live transcript.","messagePattern":"get\\(\\) cannot materialize a continuation turn without a live transcript\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/helpers/src/core/chat.ts","lineNumber":733,"sourceCode":"      return api\n    },\n\n    get(count) {\n      const deferredIndex = turns.findIndex(\n        (turn) => turn.resolve !== undefined\n      )\n      const limit = deferredIndex === -1 ? turns.length : deferredIndex\n\n      if (count === undefined) {\n        count = limit\n      }\n\n      if (!Number.isInteger(count) || count < 0) {\n        throw new RangeError(\"count must be a non-negative integer.\")\n      }\n\n      if (deferredIndex !== -1 && count > deferredIndex) {\n        throw new Error(\n          \"get() cannot materialize a continuation turn without a live transcript.\"\n        )\n      }\n\n      return turns\n        .slice(0, count)\n        .map((turn) => cloneValue(turn.message as MESSAGE))\n    },\n\n    next(messages) {\n      const turn = findNextUserTurn(messages)\n\n      return turn?.message ? cloneValue(turn.message) : null\n    },\n\n    transport(\n      transportOptions: ChatTransportOptions<\n        MESSAGE,","sourceCodeStart":715,"sourceCodeEnd":751,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/helpers/src/core/chat.ts#L715-L751","documentation":"chat.get(count) refuses to return more turns than the materialized (non-deferred) prefix. If the transcript contains a deferred continuation turn (resolve set) and count would include it, get() throws, because materializing a continuation requires a live transcript replay rather than a static snapshot.","triggerScenarios":"Calling chat.get(n) where n exceeds the index of the first deferred turn; snapshotting a chat mid-continuation before the user's approval result is applied.","commonSituations":"Replay or persistence scenarios; asking for all turns while the chat is paused on an approval-gated continuation.","solutions":["Call get() with no count (it auto-clamps to the deferred boundary) or pass a count at or below the deferred turn index.","Drive continuation turns through the transport (which replays) rather than get().","Before snapshotting, confirm no turn has resolve set."],"exampleFix":"// before\nchat.get(3) // throws if turn 2 is a deferred continuation\n\n// after\nchat.get()  // auto-stops at the deferred boundary\n// or chat.get(2)","handlingStrategy":"validation","validationCode":"// get() with no arg already clamps to the deferred boundary\nconst messages = chat.get()\n// if you must pass a count, ensure it is <= the deferred turn index","typeGuard":null,"tryCatchPattern":"try {\n  chat.get(n)\n} catch (e) {\n  if (/continuation turn without a live transcript/.test((e as Error).message)) {\n    return chat.get() // fall back to the safe prefix\n  }\n  throw e\n}","preventionTips":["Prefer chat.get() (no arg) for snapshots.","Do not request continuation turns via get(); let the transport stream them."],"tags":["chat","transcript","continuation","snapshot"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}