Skip to content

bug: Terminal tool: null "wait" parameter sent as string "None", causing 422 from open-terminal #22124

@cwawak

Description

@cwawak

Bug Description

When the AI calls run_command and passes wait: null (the parameter is optional), the backend serializes Python None as the string "None" in the query string, which fails open-terminal's FastAPI validation with a 422 error.

Steps to Reproduce

  1. Configure an admin-level open-terminal connection
  2. Ask the AI to run any shell command via the terminal tool
  3. The AI calls run_command with { "command": "uname -a", "wait": null }

Error

HTTP error 422: {"detail":[{"type":"float_parsing","loc":["query","wait"],"msg":"Input should be a valid number, unable to parse string as a number","input":"None"}]}

Root Cause

In open_webui/utils/tools.py, execute_tool_server() builds query params without filtering None values:

# ~line 1249
elif param_in == "query":
    query_params[param_name] = params[param_name]  # None included

Then serializes them:

query_string = "&".join(f"{k}={v}" for k, v in query_params.items())
# produces: wait=None  (the string "None", not omitted)

The open-terminal /run_command endpoint declares wait as Optional[float] — a valid null — but FastAPI rejects the literal string "None".

Fix

elif param_in == "query":
    if params[param_name] is not None:
        query_params[param_name] = params[param_name]

Optional parameters with no value should be omitted from the query string entirely.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions