Skip to content

fix(vision): surface actual error reason instead of generic message#1038

Closed
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/vision-surface-error-reason
Closed

fix(vision): surface actual error reason instead of generic message#1038
ygd58 wants to merge 1 commit into
NousResearch:mainfrom
ygd58:fix/vision-surface-error-reason

Conversation

@ygd58

@ygd58 ygd58 commented Mar 12, 2026

Copy link
Copy Markdown
Contributor

Problem

When vision_analyze_tool fails, the response only contained success: false and an analysis string with the error embedded in prose. The agent had no structured field to inspect the failure reason programmatically.

Fixes #1034

Change

Add "error": error_msg to the failure response dict in vision_analyze_tool.

Before:

{"success": false, "analysis": "There was a problem... Error: <reason>"}


After:

{"success": false, "error": "Error analyzing image: <reason>", "analysis": "..."}


The agent can now check result["error"] directly instead of parsing prose.
Note: provider fallback and retry are handled upstream by async_call_llm in auxiliary_client.py.
Tests
42 tests passing (test_vision_tools.py)

When vision_analyze_tool fails, the except block was returning a
generic 'could not be analyzed' message that gave the agent no
actionable information about the failure cause.

Replace the generic message with the actual exception string so the
agent can distinguish between backend errors, missing dependencies,
network failures, and unsupported image paths.

Also add an 'error' field to the failure response for structured
error handling by callers.

Fixes NousResearch#1034
@teknium1

Copy link
Copy Markdown
Contributor

Merged via #1338. I cherry-picked your structured vision error-field change onto current main so failed responses now expose a top-level field in addition to the existing analysis text.

@teknium1 teknium1 closed this Mar 14, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via #1338. I cherry-picked your structured vision error-field change onto current main so failed vision_analyze_tool responses now expose a top-level error field in addition to the existing analysis text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(vision): image analysis should recover gracefully when primary vision path fails

2 participants