Skip to content

Auto-compact fails when context exceeds 100 images/documents limit #26188

@mpale80

Description

@mpale80

Bug Description

When a conversation accumulates more than 100 images/documents, both regular API calls and /compact fail with:

API Error: 400 {"type":"error","error":{"type":"invalid_request_error","message":"too many images and documents: 101 + 0 > 100"}}

Problem

  • Auto-compact is enabled but doesn't trigger before reaching the 100 image/document limit
  • Once the limit is exceeded, /compact also fails (it needs to send context to API to create summary)
  • The only recovery is /clear, losing all conversation context

Expected Behavior

Auto-compact should trigger proactively when approaching the image/document limit (e.g., at 80-90 images), not just based on token count.

Environment

  • Claude Code version: 2.1.44
  • Installation: Native (/usr/bin/claude)
  • Platform: Linux (Debian)

Suggested Fix

Add image/document count check to auto-compact trigger logic, in addition to token-based triggers.

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