mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-07 11:28:35 -05:00
[GH-ISSUE #23943] issue: create_automation builtin tool returns "Could not detect current model", model_id missing from metadata in chat.py path #35650
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 @malte325 on GitHub (Apr 21, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/23943
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.9.1
Ollama Version (if applicable)
No response
Operating System
Ubuntu 24.04.4 LTS
Browser (if applicable)
chrome
Confirmation
README.md.Expected Behavior
create_automationshould succeed and return the created automation (id, name, next runs), using the model currently selected in the chat.Actual Behavior
The tool always fails with
"Could not detect current model". No error is logged server-side (the tool swallows its own early-return, nolog.exceptionis hit), which made this hard to diagnose initially.Steps to Reproduce
ENABLE_AUTOMATIONS=True, grant the user theautomationspermission, ensurebuiltinTools.automationsis enabled for the model.native(Chat Controls → Advanced Params → Function Calling → Native).gpt-4o, prompt something that triggers automation creation, for example:create_automationwith a valid payload (name, prompt, RRULE).{"error": "Could not detect current model"}.Logs & Screenshots
none
Additional Information
Where the error is raised
backend/open_webui/tools/builtin.py, lines 2571–2574 (v0.9.1):The tool expects
__metadata__['model_id']to be populated by the caller.Where
model_idshould be populatedbackend/open_webui/utils/middleware.py, insideprocess_chat_payload, lines 2529–2535:This line is intended to enrich
metadatawithmodel_idbefore tools are resolved.The actual bug: stale reference in
extra_paramsEarlier in the same function (lines 2272–2282),
extra_paramsis built and binds a reference to the currentmetadataobject:At line 2529, the statement
does not mutate the existing dict — it constructs a new dict from the spread and rebinds the local name
metadatato it. The dict still referenced byextra_params['__metadata__']is the original one, which has nomodel_idkey.Later at line 2746,
get_builtin_toolsis invoked withextra_paramsas-is. The builtin tool wrapper inbackend/open_webui/utils/tools.py(line 582) forwardsextra_params.get('__metadata__')directly to each builtin function's__metadata__parameter. Since that reference still points to the pre-enrichment dict,create_automationseesmodel_id = Noneand bails out.No similar issue occurs for
chat_id/message_idbecause those are set earlier (before theextra_paramsconstruction) and so are already present in the captured reference.Proposed Fix
Either mutate in place instead of rebinding at line 2529:
Or, if the existing assignment style is preferred, update
extra_params['__metadata__']alongside it:T
@Ra0k commented on GitHub (Apr 21, 2026):
Same!
@Classic298 commented on GitHub (Apr 21, 2026):
can repro
@bmc0923 commented on GitHub (Apr 21, 2026):
I have this same issue. Does it only occur for certain models or configurations? Is there anything I can do for the moment to mitigate this?
@Classic298 commented on GitHub (Apr 21, 2026):
no just broken at the moment, you can disable the builtin automations tools inside the chat if you want - you can still create automations manually
@tjbck commented on GitHub (Apr 24, 2026):
Addressed in dev.