odysseus-dev/odysseus · error · HTTPException
Not enough messages to compact
Error message
Not enough messages to compact
What it means
Error "Not enough messages to compact" thrown in odysseus-dev/odysseus.
Source
Thrown at routes/session_routes.py:976
finally:
db.close()
except KeyError:
raise HTTPException(404, f"Session {session_id} not found")
@router.post("/session/{session_id}/compact")
async def compact_session(request: Request, session_id: str):
"""Summarize older messages into one compacted history entry."""
_verify_session_owner(request, session_id)
try:
session = session_manager.get_session(session_id)
except KeyError:
raise HTTPException(404, f"Session {session_id} not found")
_reject_compact_during_active_run(session_id)
history = list(session.history or [])
if len(history) < 6:
raise HTTPException(400, "Not enough messages to compact")
# Keep a small recent tail verbatim. The prior half-chat/20-message
# tail made manual compaction look like it did nothing on normal chats.
recent_keep = min(8, max(4, len(history) // 4))
older = history[:-recent_keep]
recent = history[-recent_keep:]
if not older:
raise HTTPException(400, "Nothing old enough to compact")
from src.context_compactor import SELF_SUMMARY_SYSTEM_PROMPT
from src.endpoint_resolver import resolve_endpoint
from src.llm_core import llm_call_async
owner = getattr(session, "owner", None) or effective_user(request)
url, model, headers = resolve_endpoint("utility", owner=owner)
if not url or not model:
url, model, headers = session.endpoint_url, session.model, session.headers
if not url or not model:View on GitHub (pinned to f9235ebbf1)
Solutions
- Add more messages to the session before compacting.
- Compaction only makes sense for longer conversations.
When it happens
Trigger: Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.
Common situations: See trigger scenarios.
AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14).
Data as JSON: /api/errors/2be3a6b79d15a8e6.
Report an issue: GitHub.