Bug: Session crashes when sending image to non-vision model
Resolved 💬 1 comment Opened May 24, 2026 by Jinzhi123 Closed Jun 24, 2026
Description
When sending an image to a backend model that does not support vision (e.g., a custom model via a custom API endpoint configured via ANTHROPIC_BASE_URL), the entire Claude Code session becomes unresponsive. Subsequent text-only messages also fail until the session is restarted.
Steps to Reproduce
- Configure Claude Code to use a non-vision model via custom API endpoint:
``json``
{
"env": {
"ANTHROPIC_BASE_URL": "https://custom-api.example.com/anthropic",
"ANTHROPIC_MODEL": "non-vision-model"
}
}
- Send an image to the model (paste or attach an image file)
- The request fails (expected - model does not support images)
- Bug: The entire session becomes unresponsive
- Send a text-only message - it also fails
Expected Behavior
- Image request should fail gracefully with a user-friendly error message
- The session should remain functional for subsequent text-only requests
- User should be informed that the current model does not support image inputs
Actual Behavior
- Session crashes completely
- All subsequent requests (including text-only) fail
- User must restart Claude Code to recover
Environment
- Claude Code version: 2.1.150
- OS: Windows 10
- Backend: Custom model via third-party API endpoint
Impact
This is a poor user experience, especially for users using custom/non-Anthropic model endpoints. The error handling should gracefully degrade when a model does not support certain input types.
Suggested Fix
- Catch image-related API errors (e.g., 400/422 responses indicating unsupported input)
- Display a clear error message to the user
- Keep the session alive for subsequent requests
- Optionally: detect model capabilities on first use and warn users about unsupported features
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗