Skip to content

Images >5MB cause infinite retry loop and block session completely #2271

@0xultravioleta

Description

@0xultravioleta

Problem

When an image larger than 5MB is sent to Clawdbot, it gets stored in the session context. On every subsequent reply attempt, the Anthropic API rejects the request with:

LLM request rejected: image exceeds 5 MB maximum: 5775932 bytes > 5242880 bytes

This creates an infinite retry loop that completely blocks the session. The user cannot interact with the bot at all until manually clearing the session files.

Current Workaround

  1. Delete the session file: rm ~/.clawdbot/sessions/<session>.json
  2. Clear the session index: rm ~/.clawdbot/sessions/index.json
  3. Restart the gateway: clawdbot gateway restart

Suggested Solutions

Short term

  • Validate image size before storing in session context
  • Reject images >5MB with a friendly user-facing message
  • Or auto-resize/compress images to fit the limit

Medium term

  • Add configurable fallback to OpenAI vision API for large images (OpenAI has higher limits)
  • Something like:
{
  "image": {
    "maxSizeBytes": 5242880,
    "fallbackProvider": "openai"
  }
}

Long term

  • Health check that detects sessions with problematic images
  • Auto-recovery mechanism

Environment

  • Clawdbot version: 2026.1.24-3
  • Provider: Anthropic (Claude)
  • Channel: Telegram

Impact

This is a critical issue - it completely blocks a session with no way to recover without manual intervention.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions