Skip to content

[Bug]: Cumulative images in chat history cause HTTP 400 (Max images exceeded) on plain text messages #19099

@lcuevastodoit

Description

@lcuevastodoit

Summary

When using a multimodal LLM in a long-running chat session, the agent seems to include all previously uploaded images in the context of every new request that cause LLM api reject request with 400 Bad Request

Steps to reproduce

  1. Start a chat session with a multimodal model (e.g., via OpenClaw/Cloud API).
  2. Upload and discuss several images (e.g., 2 images in 4 separate turns).
  3. Once 8 images have been sent in the session, send a simple text message.
  4. The API returns an error because the agent attempts to re-send all 8+ previous images as part of the current context.

Expected behavior

The agent should manage the context more efficiently. Possible solutions could include:

  • Image Pruning: Dropping older images from the context after a certain number of turns.
  • Summarization: Keeping the text description/analysis of the image but removing the heavy image data from the payload of subsequent turns.
  • Configurable Limit: Allowing users to set a maximum number of historical images to be sent per request.

Actual behavior

When using a multimodal LLM in a long-running chat session, the agent seems to include all previously uploaded images in the context of every new request. Once the total number of images across the entire conversation history exceeds 8, every subsequent message (even plain text like "Hello") fails with an HTTP 400 Bad Request: "Total number of images exceeds the maximum allowed of 8".

Image

OpenClaw version

OpenClaw 2026.2.16 (5a39e13)

Operating system

model: ollama/mistral-large-3:675b-cloud / debian 13 / Telegram chat

Install method

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstaleMarked as stale due to inactivity

    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