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

Resolved 💬 2 comments Opened Feb 16, 2026 by mpale80 Closed Feb 18, 2026

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.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗