charmbracelet/crush · error
failed to summarize session: %w
Error message
failed to summarize session: %w
What it means
Thrown by Client.AgentSummarizeSession in internal/client/proto.go when the underlying HTTP POST to /workspaces/{id}/agent/sessions/{sessionID}/summarize fails at the transport level (connection error, timeout, canceled context). The request never got a response, so the error is the wrapped network-layer error from c.post. Called via AgentSummarize.
Source
Thrown at internal/client/proto.go:567
if err != nil {
return nil, fmt.Errorf("failed to get session agent info: %w", err)
}
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("failed to get session agent info: status code %d", rsp.StatusCode)
}
var info proto.AgentSession
if err := json.NewDecoder(rsp.Body).Decode(&info); err != nil {
return nil, fmt.Errorf("failed to decode session agent info: %w", err)
}
return &info, nil
}
// AgentSummarizeSession requests a session summarization.
func (c *Client) AgentSummarizeSession(ctx context.Context, id string, sessionID string) error {
rsp, err := c.post(ctx, fmt.Sprintf("/workspaces/%s/agent/sessions/%s/summarize", id, sessionID), nil, nil, nil)
if err != nil {
return fmt.Errorf("failed to summarize session: %w", err)
}
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusOK {
return fmt.Errorf("failed to summarize session: status code %d", rsp.StatusCode)
}
return nil
}
// InitiateAgentProcessing triggers agent initialization on the server.
func (c *Client) InitiateAgentProcessing(ctx context.Context, id string, interactive bool) error {
body := jsonBody(proto.AgentInitRequest{Interactive: interactive})
rsp, err := c.post(ctx, fmt.Sprintf("/workspaces/%s/agent/init", id), nil, body, http.Header{"Content-Type": []string{"application/json"}})
if err != nil {
return fmt.Errorf("failed to initiate session agent processing: %w", err)
}
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusOK {
return fmt.Errorf("failed to initiate session agent processing: status code %d", rsp.StatusCode)View on GitHub (pinned to 7944b8e522)
Solutions
- Check the wrapped cause to distinguish context.Canceled/deadline from dial errors.
- Verify the crush server is running and reachable (curl the server health endpoint).
- Retry the summarize request with a fresh context if the failure was a timeout.
- Correct the server address/URL in the client configuration if it points to a dead host.
Example fix
// before
err := client.AgentSummarize(ctx, wsID, sessionID)
if err != nil {
return err
}
// after: retry transient transport failures with a timeout
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
var lastErr error
for i := 0; i < 3; i++ {
if err := client.AgentSummarize(ctx, wsID, sessionID); err == nil {
lastErr = nil
break
} else if !errors.Is(err, context.DeadlineExceeded) && !isNetErr(err) {
lastErr = err
break
}
lastErr = err
time.Sleep(time.Second << i)
} Defensive patterns
Strategy: retry
Validate before calling
// Reachability pre-check before calling AgentSummarize
conn, err := net.DialTimeout("tcp", serverAddr, 3*time.Second)
if err != nil {
return fmt.Errorf("crush server unreachable at %s: %w", serverAddr, err)
}
conn.Close() Type guard
func isTransportError(err error) bool {
if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled) {
return true
}
var ne net.Error
return errors.As(err, &ne)
} Try / catch
err := client.AgentSummarize(ctx, wsID, sessionID)
if err != nil {
if isTransportError(err) {
return retryWithBackoff(ctx, 3, func() error {
return client.AgentSummarize(ctx, wsID, sessionID)
})
}
return err
} Prevention
- Use contexts with explicit timeouts for every client call
- Health-check the server before issuing summarize requests
- Distinguish context.Canceled (user abort) from real failures — never retry cancellations
- Keep the server address in one validated config source
When it happens
Trigger: Calling AgentSummarize/AgentSummarizeSession when the crush server is down, the workspace id or session id is stale, the network is unreachable, the context deadline expires, or DNS resolution for the server host fails.
Common situations: Server restarted or crashed while the client session was open; laptop suspended mid-run killing the TCP connection; firewall dropping long-lived connections; server address misconfigured in client config; context canceled because the user aborted the operation.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- failed to make request: %w
- failed to refresh OAuth token: %w
- failed to check project init: %w
- failed to mark project initialized: %w
- failed to get init prompt: %w
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/6b045104cf934fbe.
Report an issue: GitHub.