Skip to content

bug: vision_analyze returns 400 'Invalid request data' on valid local image paths across Anthropic/OpenAI sessions #6677

@aleparreira

Description

@aleparreira

Bug Description

vision_analyze returns 400 invalid_request_error: "Invalid request data" for valid local image paths, across different primary chat models/providers.

This makes clipboard-pasted images and ordinary local files effectively unusable in the CLI for visual inspection workflows.

This appears to be a tool/integration issue rather than a model-specific limitation:

  • reproduced with primary model anthropic/claude-opus-4-6
  • reproduced again after switching the session to openai/gpt-5.4 via OpenRouter
  • same failure shape in both cases

There is likely overlap with #6004 for clipboard images under ~/.hermes/images/, but the problem is broader: I also reproduced it on ordinary valid local JPEG/PNG paths outside the clipboard directory.

Steps to Reproduce

  1. Start Hermes CLI on macOS.
  2. Use vision_analyze on a valid local image path, for example:
    • ~/.hermes/images/clip_<timestamp>.png (clipboard image)
    • /path/to/project/runtime/artifacts/photos/example.jpg (ordinary local JPEG)
  3. Ask for any simple description, e.g. "Describe the image in detail".
  4. Observe tool failure.
  5. Switch the primary session model/provider (I tested Anthropic -> OpenAI) and retry.
  6. Observe the same failure again.

Expected Behavior

  • vision_analyze should successfully analyze valid local images, or
  • if local files are unsupported in the current execution path, it should return a clear actionable error (e.g. "local image paths are not mounted/available in sandbox") rather than a generic provider 400.

Actual Behavior

The tool returns a provider error like:

Error analyzing image: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'Invalid request data'}, 'request_id': 'req_...'}

This happens repeatedly on valid local images.

I also saw one size-related 400 on a larger upscaled JPEG:

messages.0.content.1.image.source.base64: image exceeds 5 MB maximum: 6937612 bytes > 5242880 bytes

That size error is expected for that specific file, but the main bug is that smaller valid images still fail with the generic Invalid request data 400.

Environment

  • OS: macOS 15.3 / Darwin 25.3.0 arm64
  • Repo: NousResearch/hermes-agent
  • Version/Commit: 268ee6bd
  • Python version: Python 3.9.6
  • Primary chat models tested:
    • anthropic/claude-opus-4-6
    • openai/gpt-5.4 (via OpenRouter)

Error Output

Clipboard image path:

vision_analyze(image_url="~/.hermes/images/clip_<timestamp>.png")
→ Error code: 400
→ invalid_request_error: Invalid request data

Ordinary local JPEG path:

vision_analyze(image_url="/path/to/project/runtime/artifacts/photos/example.jpg")
→ Error code: 400
→ invalid_request_error: Invalid request data

Another local JPEG after switching primary model to GPT-5.4:

same 400 invalid_request_error: Invalid request data

Additional Context

  • file identifies the JPEG as valid:
JPEG image data, JFIF standard 1.01, 1280x1197, components 3
  • The clipboard-path failure may be partly explained by #6004 (clipboard images not mounted into Docker sandbox), but the ordinary local JPEG failure suggests the problem is not limited to ~/.hermes/images/.
  • The repeated cross-provider failure suggests the bug is likely in the vision_analyze local-file handling / auxiliary vision request construction, not in the main chat model selection.
  • A better error classification would help even before the root fix lands.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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