BerriAI/litellm · error · AnthropicContextManagementError
context_management.compact_20260112.trigger.value must be…
Error message
context_management.compact_20260112.trigger.value must be at least {COMPACT_MIN_TRIGGER_TOKENS} tokens What it means
Error "context_management.compact_20260112.trigger.value must be at least {COMPACT_MIN_TRIGGER_TOKENS} tokens" thrown in BerriAI/litellm.
Solutions
- Raise context_management.compact trigger value to at least the minimum token count shown in the error.
When it happens
Trigger: Thrown at litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py:562 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/d50db9ec8261be53.
Report an issue: GitHub.
Appendix: source
Thrown at litellm/llms/anthropic/experimental_pass_through/context_management/editors/compact.py:562
"""
warnings: Final[list[str]] = []
trigger: Final = edit_spec.get("trigger") or {}
if not isinstance(trigger, dict):
warnings.append("trigger_not_a_dict_using_default")
return COMPACT_DEFAULT_TRIGGER_TOKENS, warnings
trigger_type: Final = trigger.get("type", "input_tokens")
if trigger_type != "input_tokens":
warnings.append(f"unsupported_trigger_type_{trigger_type}_using_input_tokens")
value: Final = trigger.get("value")
if value is None:
return COMPACT_DEFAULT_TRIGGER_TOKENS, warnings
if not isinstance(value, int):
warnings.append("trigger_value_not_int_using_default")
return COMPACT_DEFAULT_TRIGGER_TOKENS, warnings
if value < COMPACT_MIN_TRIGGER_TOKENS:
raise AnthropicContextManagementError(
status_code=400,
message=(
f"context_management.compact_20260112.trigger.value must be at "
f"least {COMPACT_MIN_TRIGGER_TOKENS} tokens"
),
)
return value, warnings
def _build_summary_prompt(edit_spec: Mapping[str, object], tools: Sequence[Mapping[str, object]] | None) -> str:
custom: Final = edit_spec.get("instructions")
if isinstance(custom, str) and custom.strip():
return custom
prompt = COMPACT_DEFAULT_INSTRUCTIONS
if tools:
prompt = f"{prompt}{COMPACT_NO_TOOL_CALLS_SUFFIX}"
return prompt
View on GitHub (pinned to 77b7c6c40c)