chenhg5/cc-connect · error
agent process exited during compress
Error message
agent process exited during compress
What it means
During a /compress operation the engine watches the agent's event stream; if the events channel closes (agent process died mid-compress) the engine notifies that queued messages were dropped with this reason, sends any text already collected, and aborts the compress. It distinguishes "compress crashed" from "compress timed out".
Source
Thrown at core/engine.go:10546
for {
var event Event
var ok bool
select {
case <-stopCh:
return
case event, ok = <-events:
if !ok {
e.cleanupInteractiveState(sessionKey, state)
if !auto {
if len(textParts) > 0 {
e.send(p, replyCtx, strings.Join(textParts, ""))
} else {
e.reply(p, replyCtx, e.i18n.T(MsgCompressDone))
}
}
e.notifyDroppedQueuedMessages(state, fmt.Errorf("agent process exited during compress"))
return
}
case <-idleCh:
if !auto {
e.send(p, replyCtx, fmt.Sprintf(e.i18n.T(MsgError), "compress timed out"))
}
e.cleanupInteractiveState(sessionKey, state)
e.notifyDroppedQueuedMessages(state, fmt.Errorf("compress timed out"))
return
case <-e.ctx.Done():
return
}
if state.isStopped() {
return
}
if idleTimer != nil {View on GitHub (pinned to 4000b2338a)
Solutions
- Restart a session and retry /compress; the partial text already streamed was delivered before the abort
- Check agent logs at the crash point; compression of very large contexts can OOM the agent
- Reduce conversation size (start /new) if compresses repeatedly kill the agent
- Raise memory limits if the agent is being OOM-killed during compress
Defensive patterns
Strategy: retry
Validate before calling
if err := exec.Command(agentBin, "--version").Run(); err != nil { return err }; if memAvailable() < minAgentMemBytes { return fmt.Errorf("insufficient memory for compress") } Try / catch
On the dropped-message notification containing "agent process exited during compress", wait for the session to restart and retry /compress once before escalating.
Prevention
- Keep conversations under a size where compress fits comfortably in memory
- Raise agent memory limits if compresses coincide with OOM kills
- Run /compress on an otherwise idle session
- Keep the agent CLI updated to a version without known crash bugs on long contexts
When it happens
Trigger: Agent process exits while a compress loop is in its event-watching select — the channelClosed branch of the compress event loop — with queued messages waiting; typically an agent crash/OOM during the (context-heavy) compression request.
Common situations: Context is huge when compressing (the compression prompt pushes the agent over memory limits); agent CLI crash on long conversations; host OOM-kill during compress.
Related errors
- compress timed out
- session is closed
- process exited
- session is closed
- piSession: write get_state probe: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/c1b89c6b8e8d57d7.
Report an issue: GitHub.