Skip to content

bug: vision_analyze first call returns 400 when main model lacks vision support #57948

Description

@webtecnica

Description

When vision_analyze is called and the main model does not support image inputs, the first invocation fails with a 400 error instead of automatically falling back to the configured auxiliary.vision provider. The second call succeeds without any configuration changes.

Expected Behavior

The system prompt indicates that when 'the active model has native vision, the image is attached to your context directly; otherwise Hermes falls back to an auxiliary vision model'. This fallback should happen automatically on the first attempt.

Actual Behavior

First call:

Error analyzing image: Error code: 400 - {'error': {'message': 'The provided messages input is invalid. The error info is [Unexpected item type in content].'}}

Second call (same image, no config change): Success.

Configuration

auxiliary:
  vision:
    provider: openrouter
    model: nvidia/nemotron-nano-12b-v2-vl:free
    timeout: 120
    download_timeout: 30

Main model: qwen3.7-max (custom/Alibaba provider) — does NOT support vision.

Reproduction Steps

  1. Configure auxiliary.vision with OpenRouter + a free vision model
  2. Set a non-vision model as primary (e.g., qwen3.7-max)
  3. Attach an image via WebUI or CLI
  4. Call vision_analyze(image_url='/path/to/image.jpg', question='...')
  5. Observe error 400 on first attempt
  6. Retry same call → succeeds

Environment

  • Hermes Agent v0.18.0 (2026.7.1)
  • WebUI session
  • Primary provider: custom (Alibaba MAAS, ap-southeast-1)
  • Fallback chain: deepseek-v4-flash, deepseek-v4-pro, qwen3.6-plus, qwen-plus (all custom/Alibaba)

Hypothesis

The vision tool likely attempts to inject the image into the primary model's message payload first, and only falls back to auxiliary.vision after the primary call fails. The fallback logic should check model capabilities upfront rather than retrying after a 400 error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existscomp/agentCore agent runtime: loop, agent_init, prompt builder, context-compression, responses endpointsweeper:implemented-on-mainSweeper: behavior already present on current maintool/visionVision analysis and image generationtype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions