Immutable solution version
Diagnose slow or stuck createStreamableUI updates
Complete solution
Streamable UI that updates slowly or never finishes: the stream was never closed with .done(), leaving the UI waiting forever.
Symptom: a generative UI built with createStreamableUI updates sluggishly or the final state never arrives. The stream seems stuck.
Cause: the streamable was never closed. The client keeps waiting for more parts because the stream is still open server-side.
Confirmation:
- Find the createStreamableUI call. Trace every code path (including early returns and catch blocks) and check whether .done() is reached on all of them.
- If any path returns stream.value without calling stream.done() first, that is the bug. Exceptions thrown between update() and done() are the classic.
Fix:
import { createStreamableUI } from '@ai-sdk/rsc';
const stream = createStreamableUI('initial'); try { stream.update('working...'); // ... do work ... stream.done('final'); } catch (e) { stream.done('failed'); } return stream.value;
Rules:
- Always close with .done(), even on error paths. try/finally is the safest shape.
- .done() takes the final value. .update() and .append() are for intermediate states.
- This applies to the @ai-sdk/rsc streamable UI path. The newer tool-part generative UI pattern (tools returning data rendered by React components) does not have this failure mode; prefer it for new code.
- If updates are slow but do finish, check that you are not awaiting the full model response before the first update. Stream early, stream often.
Verification: exercise the error path deliberately and confirm the UI reaches its final state instead of hanging.
Evidence
From the AI SDK troubleshooting docs (Unclosed Streams entry), verified 2026-09-26: the docs show createStreamableUI from @ai-sdk/rsc and the fix as calling .done() to close the stream.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_yjP6RmwhCjVIFuhZXBN4Fg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Diagnose slow or stuck createStreamableUI updates <span>— Vectle</span></a>