charmbracelet/crush · error
failed to get session agent queued prompts
Error message
failed to get session agent queued prompts: %w
What it means
GetAgentSessionQueuedPrompts performs GET /workspaces/{id}/agent/sessions/{sessionID}/prompts/queued and wraps any transport error from c.get with this message. It fires when the request never completes successfully at the HTTP layer, with the cause wrapped for inspection.
Solutions
- Verify server availability and base URL
- Check both workspace ID and session ID are valid and URL-escaped
- Stop polling once the session is known to be closed
- Inspect the wrapped error for the transport root cause
Example fix
// before
n, err := client.GetAgentSessionQueuedPrompts(ctx, wsID, sessionID)
// after
n, err := client.GetAgentSessionQueuedPrompts(ctx, url.PathEscape(wsID), url.PathEscape(sessionID))
if err != nil {
return 0, fmt.Errorf("poll queue: %w", err)
} Defensive patterns
Strategy: retry
Validate before calling
if sessionID == "" || wsID == "" { return errors.New("workspace and session IDs required") }
if err := ctx.Err(); err != nil { return err } Type guard
func isNetworkErr(err error) bool {
var ne net.Error
return errors.As(err, &ne) || errors.Is(err, syscall.ECONNRESET) || errors.Is(err, context.DeadlineExceeded)
} Try / catch
n, err := client.GetAgentSessionQueuedPrompts(ctx, wsID, sid)
if err != nil && isNetworkErr(err) {
time.Sleep(backoff)
return client.GetAgentSessionQueuedPrompts(ctx, wsID, sid)
} Prevention
- Stop polling when the session is known to be closed
- Use timeouts on polling contexts
- Escape path parameters
- Verify server health before entering poll loops
When it happens
Trigger: Calling GetAgentSessionQueuedPrompts with an unreachable server, malformed workspace or session ID producing a bad path, canceled context, or connection reset during c.get.
Common situations: Session already ended/cleaned up server-side while the client still polls; wrong workspace ID; network interruption in long-running polling loops (AgentQueuedPrompts).
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 answer question batch
- failed to cancel question batch
- failed to check project init
- failed to clear session agent queued prompts
- failed to decode session agent info
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/912414a492046b5d.
Report an issue: GitHub.
Appendix: source
Thrown at internal/client/proto.go:430
Name string `json:"name"`
}{Name: name}),
http.Header{"Content-Type": []string{"application/json"}})
if err != nil {
return fmt.Errorf("failed to refresh MCP resources: %w", err)
}
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusOK {
return fmt.Errorf("failed to refresh MCP resources: status code %d", rsp.StatusCode)
}
return nil
}
// GetAgentSessionQueuedPrompts retrieves the number of queued prompts for a
// session.
func (c *Client) GetAgentSessionQueuedPrompts(ctx context.Context, id string, sessionID string) (int, error) {
rsp, err := c.get(ctx, fmt.Sprintf("/workspaces/%s/agent/sessions/%s/prompts/queued", id, sessionID), nil, nil)
if err != nil {
return 0, fmt.Errorf("failed to get session agent queued prompts: %w", err)
}
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusOK {
return 0, fmt.Errorf("failed to get session agent queued prompts: status code %d", rsp.StatusCode)
}
var count int
if err := json.NewDecoder(rsp.Body).Decode(&count); err != nil {
return 0, fmt.Errorf("failed to decode session agent queued prompts: %w", err)
}
return count, nil
}
// ClearAgentSessionQueuedPrompts clears the queued prompts for a session.
func (c *Client) ClearAgentSessionQueuedPrompts(ctx context.Context, id string, sessionID string) error {
rsp, err := c.post(ctx, fmt.Sprintf("/workspaces/%s/agent/sessions/%s/prompts/clear", id, sessionID), nil, nil, nil)
if err != nil {
return fmt.Errorf("failed to clear session agent queued prompts: %w", err)
}View on GitHub (pinned to 7944b8e522)