Skip to content

issue: Builtin tool functions crash with TypeError when models pass numeric parameters as strings via native function calling. #25641

@ericnicolaides

Description

@ericnicolaides

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Docker

Open WebUI Version

Open WebUI version: 0.9.6

Ollama Version (if applicable)

Model: Llama 3.3 70B (via vLLM with native tool calling)

Operating System

Debian 13

Browser (if applicable)

Search engine: SearXNG

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

When a model using native function calling (function_calling: native) emits a tool call with numeric parameters as strings (e.g., "count": "1" instead of "count": 1), the builtin tool functions should coerce the values to int before use and execute normally.

Actual Behavior

The builtin tool functions declare int/Optional[int] type hints but never coerce the actual runtime values. When the model passes a numeric parameter as a string, any comparison or arithmetic on that value raises:

TypeError: '<' not supported between instances of 'int' and 'str'


This crashes the tool call and the model receives an error response instead of search results.

Steps to Reproduce

1. Configure a model with native function calling enabled (Admin Panel → Function Calling = Native)
2. Enable SearXNG web search
3. In a chat, ask the model to search for something (e.g., "What is the weather in Portland OR?")
4. The model emits a tool call: search_web(query="Portland Oregon weather today", count=1)
5. If the model passes count as the string "1" in the tool call JSON, the min(count, max_count) comparison on line 233 of builtin.py crashes with TypeError

Logs & Screenshots

2026-06-03 02:15:56.762 | ERROR | open_webui.tools.builtin:search_web:245 - search_web error: '<' not supported between instances of 'int' and 'str'

Full traceback shows the error at:

File "/app/backend/open_webui/utils/middleware.py", line 4645, in response_handler
    tool_result = await tool_function(**tool_function_params)

Additional Information

20 builtin tool functions in backend/open_webui/tools/builtin.py are affected — any that accept int or Optional[int] parameters and use them in comparisons, arithmetic, or slicing:

- search_web: min(count, max_count)
- calculate_timestamp: days_ago + (weeks_ago * 7), months_ago > 0, years_ago > 0
- search_notes, search_chats, search_channel_messages: start_timestamp * 1_000_000_000, end_timestamp * 1_000_000_000
- search_memories, search_channels, list_knowledge_bases, search_knowledge_bases, search_knowledge_files, list_knowledge, query_knowledge_files, query_knowledge_bases, list_automations, search_calendar_events: count used in comparisons and slicing
- view_file, view_knowledge_file: max_chars, start_line, end_line, offset used in slicing and min()/max()
- create_calendar_event, update_calendar_event: reminder_minutes

Environment: Open WebUI 0.9.6, Llama 3.3 70B via vLLM (native function calling enabled), SearXNG search backend

Proposed fix: Add int() coercion at the start of each builtin tool function for all numeric parameters. Optional[int] params use int(param) if param is not None else None to preserve None semantics. A PR is forthcoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions