Skip to content

Ollama models that don't support tools receive tool definitions, causing 400 errors #2787

Description

@graycyrus

Summary

The inference layer sends tool definitions to ollama models that don't support them (e.g. gemma3:1b-it-qat), causing 400 Bad Request errors: "does not support tools".

Problem

What happened: When a chat request includes tool definitions and routes through an ollama model that doesn't support tools, the request fails with:

{"error":{"message":"registry.ollama.ai/library/gemma3:1b-it-qat does not support tools","type":"invalid_request_error","param":null,"code":null}}

Expected: The inference layer should either:

  1. Strip tool definitions from the request when the model doesn't support tools, OR
  2. Detect the "does not support tools" error and retry without tools, OR
  3. Pre-check model capabilities before sending tools

Impact: 14 events in Sentry (TAURI-RUST-4K7), escalating. Affects any ollama model without tool support. The trace also shows related errors with bge-m3:latest ("does not support chat") — embedding models being used for chat.

Steps to reproduce:

  1. Configure ollama with a model that doesn't support tools (e.g. gemma3:1b-it-qat)
  2. Send a chat message that includes tool definitions
  3. Observe 400 error

Version / Platform: openhuman@0.56.0, Windows 10.0.26200, rustc 1.93.0

Solution (optional)

The ollama provider should handle the "does not support tools" error gracefully. Options:

  1. Best: Query ollama's /api/show endpoint at provider init to check model capabilities, and strip tools for non-supporting models
  2. Simpler: Catch the specific "does not support tools" 400 error and retry the request without tools
  3. Minimum: Strip tools from the request body when the model name is known to not support tools (less robust)

Acceptance criteria

  • Repro gone — Ollama models without tool support no longer get 400 errors from tool definitions being sent.
  • Regression safety — Unit test added to verify tool stripping for non-tool-supporting models.
  • Diff coverage >= 80% — the fix PR meets the changed-lines coverage gate.
  • Tool-supporting models unaffected — models that DO support tools still receive them.

Related

Activity

  1. self-assigned this
    on May 27, 2026
  2. moved this from In progress to Done in Team Openhumanon May 28, 2026
  3. added a commit that references this issue on May 28, 2026
    c146a10
  4. added theissue type on Aug 9, 2026
  5. added a commit that references this issue on Sep 11, 2026
    412c356
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions