charmbracelet/crush · error
failed to set permissions skip requests: status code %d
Error message
failed to set permissions skip requests: status code %d
What it means
This error is returned by Client.SetPermissionsSkipRequests when the HTTP POST to /workspaces/{id}/permissions/skip completes but responds with a non-200 status code. It is a deliberate guard: the server accepted the request but rejected or failed it, so the skip-requests flag was not updated. The status code is embedded in the message for diagnosis.
Source
Thrown at internal/client/proto.go:742
if rsp.StatusCode != http.StatusOK {
return false, fmt.Errorf("failed to cancel question batch: status code %d", rsp.StatusCode)
}
var resp proto.QuestionAnswerResponse
if err := json.NewDecoder(rsp.Body).Decode(&resp); err != nil {
return false, fmt.Errorf("failed to decode cancel question batch response: %w", err)
}
return resp.Resolved, nil
}
// SetPermissionsSkipRequests sets the skip-requests flag for a workspace.
func (c *Client) SetPermissionsSkipRequests(ctx context.Context, id string, skip bool) error {
rsp, err := c.post(ctx, fmt.Sprintf("/workspaces/%s/permissions/skip", id), nil, jsonBody(proto.PermissionSkipRequest{Skip: skip}), http.Header{"Content-Type": []string{"application/json"}})
if err != nil {
return fmt.Errorf("failed to set permissions skip requests: %w", err)
}
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusOK {
return fmt.Errorf("failed to set permissions skip requests: status code %d", rsp.StatusCode)
}
return nil
}
// GetPermissionsSkipRequests retrieves the skip-requests flag for a workspace.
func (c *Client) GetPermissionsSkipRequests(ctx context.Context, id string) (bool, error) {
rsp, err := c.get(ctx, fmt.Sprintf("/workspaces/%s/permissions/skip", id), nil, nil)
if err != nil {
return false, fmt.Errorf("failed to get permissions skip requests: %w", err)
}
defer rsp.Body.Close()
if rsp.StatusCode != http.StatusOK {
return false, fmt.Errorf("failed to get permissions skip requests: status code %d", rsp.StatusCode)
}
var skip proto.PermissionSkipRequest
if err := json.NewDecoder(rsp.Body).Decode(&skip); err != nil {
return false, fmt.Errorf("failed to decode permissions skip requests: %w", err)
}View on GitHub (pinned to 7944b8e522)
Solutions
- Read the status code in the message: 401/403 -> re-authenticate or re-login to refresh credentials; 404 -> verify the workspace id exists via the workspaces list API.
- Confirm the server you are connected to supports the permissions/skip endpoint (server version matches your client).
- Inspect server logs for a 4xx/5xx trace at /workspaces/{id}/permissions/skip and fix the request body or server-side issue.
- Retry after fixing; if 5xx persists, check server health/proxy configuration.
Example fix
// before: blindly calling with a stale workspace id
err := c.SetPermissionsSkipRequests(ctx, wsID, true)
// after: validate id and handle status
code := statusFromErr(err) // e.g. parse "status code %d"
if strings.Contains(err.Error(), "status code 404") {
ws, lerr := c.ListWorkspaces(ctx)
if lerr == nil && len(ws) > 0 {
err = c.SetPermissionsSkipRequests(ctx, ws[0].ID, true)
}
} Defensive patterns
Strategy: try-catch
Validate before calling
// Go: check workspace exists and connectivity first
if _, err := c.ListWorkspaces(ctx); err != nil {
return fmt.Errorf("server unreachable or auth invalid: %w", err)
} Try / catch
if err := c.SetPermissionsSkipRequests(ctx, id, skip); err != nil {
var codeErr interface{ Error() string }
_ = codeErr
if strings.Contains(err.Error(), "status code 40") {
// auth/authorization or not-found: re-login or fix id
} else if strings.Contains(err.Error(), "status code 5") {
// server-side: retry with backoff
}
return err
} Prevention
- Refresh authentication tokens before long sessions.
- Validate workspace ids against the list API before mutating.
- Match client and server versions so the permissions/skip endpoint exists.
- Log full status codes on non-200 responses.
When it happens
Trigger: Calling SetPermissionsSkipRequests against a workspace whose id does not exist (404), when the client is not authenticated or its token expired (401/403), when the JSON body fails server-side validation (400), or when the server is misbehaving (5xx). Any response other than http.StatusOK triggers it.
Common situations: Running a session whose daemon/token has expired; pointing the client at a server version that does not expose the permissions/skip endpoint (405/404); typo or stale workspace id after the workspace was deleted; a proxy or dev server returning 500.
Related errors
- failed to get permissions skip requests: %w
- failed to download from URL: %w
- failed to create request: %w
- failed to fetch URL: %w
- failed to fetch URL: %w
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/fa7e939b17d16dc1.
Report an issue: GitHub.