charmbracelet/crush · error

failed to set permissions skip requests: %w

Error message

failed to set permissions skip requests: %w

What it means

SetPermissionsSkipRequests POSTs to /workspaces/{id}/permissions/skip to toggle the skip-permission-requests flag. This error wraps transport-level failures from c.post — the request never completed, so the skip flag was not changed on the server.

Source

Thrown at internal/client/proto.go:738

	if err != nil {
		return false, fmt.Errorf("failed to cancel question batch: %w", err)
	}
	defer rsp.Body.Close()
	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)
	}

View on GitHub (pinned to 7944b8e522)

Solutions

  1. Verify the server is reachable and the base URL/port is correct, then retry the call.
  2. Check network/VPN/proxy connectivity if the failure is intermittent.
  3. Increase the context deadline if requests are timing out.
  4. Confirm the flag took effect by reading workspace state after a successful call.

Example fix

// before
err := client.SetPermissionsSkipRequests(ctx, wsID, true)
// after
err := client.SetPermissionsSkipRequests(ctx, wsID, true)
if err != nil {
	return fmt.Errorf("toggling skip-permission-requests for %s: %w", wsID, err)
}
Defensive patterns

Strategy: retry

Validate before calling

// Verify connectivity before toggling the skip flag
if err := serverReachable(ctx, baseURL); err != nil {
	return fmt.Errorf("skip flag not changed: %w", err)
}

Try / catch

err := client.SetPermissionsSkipRequests(ctx, wsID, true)
if err != nil {
	if errors.Is(err, context.DeadlineExceeded) {
		return retrySetSkip(ctx, wsID, true, 3) // idempotent flag set
	}
	return fmt.Errorf("setting skip-requests: %w", err)
}

Prevention

When it happens

Trigger: Calling SetPermissionsSkipRequests when the server is down/unreachable, DNS or TLS fails, the network drops, or ctx is cancelled mid-request.

Common situations: Toggling auto-approve while offline; server restarted between UI action and call; misconfigured server address; short context deadline on slow networks.

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


AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29). Data as JSON: /api/errors/2edda07396bdd9b7. Report an issue: GitHub.