juanfont/headscale · error
approving auth request: %w
Error message
approving auth request: %w
What it means
Transport error from 'headscale auth approve': the POST to approve a pending auth request failed at the HTTP layer (client.AuthApproveWithResponse returned err). No status code exists; server-side rejection of a bad/expired auth-id would instead appear as a non-200 handled by apiError.
Source
Thrown at cmd/headscale/cli/auth.go:71
node := resp.JSON200.Node
return printOutput(
cmd,
node,
fmt.Sprintf("Node %s registered", node.GivenName),
)
}),
}
var authApproveCmd = &cobra.Command{
Use: "approve",
Short: "Approve a pending authentication request",
RunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {
authID, _ := cmd.Flags().GetString("auth-id")
resp, err := client.AuthApproveWithResponse(ctx, clientv1.AuthApproveJSONRequestBody{AuthId: &authID})
if err != nil {
return fmt.Errorf("approving auth request: %w", err)
}
if resp.StatusCode() != http.StatusOK {
return apiError(resp.StatusCode(), resp.ApplicationproblemJSONDefault)
}
return printOutput(cmd, resp.JSON200, "Auth request approved")
}),
}
var authRejectCmd = &cobra.Command{
Use: "reject",
Short: "Reject a pending authentication request",
RunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {
authID, _ := cmd.Flags().GetString("auth-id")
resp, err := client.AuthRejectWithResponse(ctx, clientv1.AuthRejectJSONRequestBody{AuthId: &authID})
if err != nil {View on GitHub (pinned to 565fd254d0)
Solutions
- Restore/verify server connectivity ('headscale health')
- Validate the CLI's address and CA settings
- Re-check the pending auth request still exists ('headscale auth list' equivalent) after reconnecting, then approve again
Defensive patterns
Strategy: retry
Try / catch
if _, err := client.AuthApproveWithResponse(ctx, body); err != nil {
if isTransportError(err) { retryOnce() } else { return err }
} Prevention
- Approve promptly while the auth request is fresh
- Confirm the auth-id exists before approving in automation
When it happens
Trigger: 'headscale auth approve --auth-id ...' while the server is down, TLS trust is broken, or the request times out.
Common situations: Node registration automation where the server restarts between the node's login attempt and the admin's approval; misconfigured CLI endpoint.
Related errors
- rejecting auth request: %w
- listing api keys: %w
- creating api key: %w
- expiring api key: %w
- deleting api key: %w
AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15).
Data as JSON: /api/errors/baa02b42e8ed8422.
Report an issue: GitHub.