-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StreamUI unhandledRejection: Error: .update(): UI stream is already closed. #3007
Comments
Hi @lgrammel Any solution for this issue? My app has been encountering this issue quite frequently lately which made many paid customers frustrated/churned. This issue started occurring several weeks ago already. I couldn't find any workaround fix on my own. This is very urgent. Please help. |
This happens when First try to turn off parallel tool calls (especially w/ openai - see OpenAI provider https://sdk.vercel.ai/providers/ai-sdk-providers/openai ). If that is not sufficient, you can use |
@lgrammel How can I turn off parallelToolCalls with createOpenAI? I tried this but it says 'parallelToolCalls' does not exist in type 'OpenAICompletionSettings' Is there anyway to disable it from the streamUI() function itself? |
It is available when you use chat models (completion models don't support tool calls to begin with): https://sdk.vercel.ai/providers/ai-sdk-providers/openai#chat-models |
It's not okey when I turn off the "parallelToolCalls" config, the error occurs as before. const openai = createOpenAI({
baseURL: process.env.OPENAI_API_BASE,
apiKey: process.env.OPENAI_API_KEY,
})
let openaiApiModel = process.env.OPENAI_API_MODEL || 'gpt-4o'
let model = openai.chat(openaiApiModel, {
parallelToolCalls: false
}) |
please try my other suggestions in that case, and also check out this comment: #2810 (comment) You are seeing this error because you are trying to update an already closed rsc stream (streamableUI). |
I think this is a bug. Please fix it in the next version. |
When i upgrade the latest version of ai, the bug still exists. |
Same issue here. |
Description
The StreamUI calling tool reports an error, but the normal output components:
Error: .update(): UI stream is already closed.
at assertStream (G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12394:19)
at Object.update (G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12412:13)
at handleRender (G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12830:21)
at G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12870:29
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
⨯ unhandledRejection: Error: .update(): UI stream is already closed.
at assertStream (G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12394:19)
at Object.update (G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12412:13)
at handleRender (G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12830:21)
at G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12870:29
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
⨯ unhandledRejection: Error: .update(): UI stream is already closed.
at assertStream (G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12394:19)
at Object.update (G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12412:13)
at handleRender (G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12830:21)
at G:\ai-project\ai-chatbot.next\server\chunks\ssr_39f80c..js:12870:29
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Code example
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: