mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-27 17:04:57 -05:00
[GH-ISSUE #21927] UX: 'Network connection lost' when built-in tool call has malformed/incomplete arguments — needs graceful error handling #90358
Reference in New Issue
Block a user
Originally created by @sewasti on GitHub (Feb 27, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21927
Summary
When a model generates incomplete or malformed JSON for a built-in tool call (e.g., missing required parameters like
contentinreplace_note_content), OWUI'sresponse_handlerinutils/middleware.pyfails to parse the arguments and terminates the SSE stream. The browser shows "Network connection lost" — leaving the user with no actionable information and no way to understand what went wrong.Environment
anthropic/claude-sonnet-4.6via OpenRouter (with extended thinking /reasoning_effort: high)search_notes,view_note,replace_note_content)Steps to Reproduce
replace_note_contentnote_idandtitlebut the stream is cut before the largecontentfield is emitted)ERRORand terminates the SSE streamLog Evidence
The JSON is truncated —
json.loads()andast.literal_eval()both fail. The handler currently silently drops the connection.Code Path (v0.8.5)
In
open_webui/utils/middleware.py,response_handleraround line 4059:Expected Behavior
When tool argument parsing fails, OWUI should:
requiredfields before executing — reject calls with missing required params with a clear message instead of a Python exception downstreamProposed Fix (sketch)
Impact
Additional Context
This was observed with
replace_note_content(built-in Notes tool) where thecontentparameter — which contains the full note markdown — is the last and largest JSON field. On first attempt the model omitted it; on retry (with longer thinking time) it succeeded. Better error surfacing would make this a minor UX annoyance rather than a confusing hard failure.