mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[GH-ISSUE #23924] fix: Client-provided tools crash Ollama models without native tool support (returns null) #58777
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @pvyswiss on GitHub (Apr 21, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23924
Bug Description
API clients that send
toolsandtool_choice(e.g., for title generation) crash Ollama models that don't support tools (DeepSeek R1). Open WebUI catches the exception but returnsnull, crashing the SDK.Related to: #23917 (Bug 5)
Root Cause
API clients like
@ai-sdk/openai-compatibleautomatically sendtoolsif the caller supports them. Open WebUI passes these through to Ollama, which rejects them for models without tool support.The
except Exceptionhandler logs at DEBUG level and falls through without returning a proper response.Noneis serialized asnull.Fix
Strip client-provided
toolsandtool_choicewhen the model doesn't havefunction_calling: "native":Also upgrade error handler from
log.debugtolog.warning.Impact
tools_dictin middleware)File
backend/open_webui/main.pyReproduction
@tjbck commented on GitHub (Apr 24, 2026):
Addressed in dev to forward relevant error messages.