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

Closed
opened 2026-04-25 09:23:32 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @cwawak on GitHub (Mar 2, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/22124

Originally assigned to: @Classic298 on GitHub.

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.

Originally created by @cwawak on GitHub (Mar 2, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/22124 Originally assigned to: @Classic298 on GitHub. ## 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: ```python # ~line 1249 elif param_in == "query": query_params[param_name] = params[param_name] # None included ``` Then serializes them: ```python 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 ```python 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.
Author
Owner

@pr-validator-bot commented on GitHub (Mar 2, 2026):

⚠️ Missing Issue Title Prefix

@cwawak, your issue title is missing a prefix (e.g., bug:, feat:, docs:).

Please update your issue title to include one of the following prefixes:

  • bug: Bug report or error you've encountered
  • feat: Feature request or enhancement suggestion
  • docs: Documentation issue or improvement request
  • question: Question about usage or functionality
  • help: Request for help or support

Example: bug: Login fails when using special characters in password

<!-- gh-comment-id:3981523251 --> @pr-validator-bot commented on GitHub (Mar 2, 2026): # ⚠️ Missing Issue Title Prefix @cwawak, your issue title is missing a prefix (e.g., `bug:`, `feat:`, `docs:`). Please update your issue title to include one of the following prefixes: - **bug**: Bug report or error you've encountered - **feat**: Feature request or enhancement suggestion - **docs**: Documentation issue or improvement request - **question**: Question about usage or functionality - **help**: Request for help or support Example: `bug: Login fails when using special characters in password`
Author
Owner

@Classic298 commented on GitHub (Mar 2, 2026):

taking a look here

<!-- gh-comment-id:3985362374 --> @Classic298 commented on GitHub (Mar 2, 2026): taking a look here
Author
Owner

@Classic298 commented on GitHub (Mar 2, 2026):

https://github.com/open-webui/open-webui/pull/22144 @tjbck

<!-- gh-comment-id:3985544863 --> @Classic298 commented on GitHub (Mar 2, 2026): https://github.com/open-webui/open-webui/pull/22144 @tjbck
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#35165