juanfont/headscale · error

rejecting auth request: %w

Error message

rejecting auth request: %w

What it means

Transport error from 'headscale auth reject': client.AuthRejectWithResponse failed before an HTTP response arrived. As with approve, this covers connection/TLS/timeout failures; a rejected-by-server scenario (e.g., unknown auth-id) surfaces as an HTTP error via apiError instead.

Source

Thrown at cmd/headscale/cli/auth.go:90

		}

		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 {
			return fmt.Errorf("rejecting auth request: %w", err)
		}

		if resp.StatusCode() != http.StatusOK {
			return apiError(resp.StatusCode(), resp.ApplicationproblemJSONDefault)
		}

		return printOutput(cmd, resp.JSON200, "Auth request rejected")
	}),
}

View on GitHub (pinned to 565fd254d0)

Solutions

  1. Check server health and CLI address/TLS configuration
  2. Retry the reject after connectivity is restored
  3. If the auth request has already expired server-side, the reject is unnecessary — verify with the pending list
Defensive patterns

Strategy: retry

Try / catch

if _, err := client.AuthRejectWithResponse(ctx, body); err != nil {
	if isTransportError(err) { /* check pending list first, then retry */ }
}

Prevention

When it happens

Trigger: 'headscale auth reject --auth-id ...' with an unreachable server, cancelled context, or TLS mismatch.

Common situations: Cleanup scripts rejecting stale registrations after a server outage; wrong endpoint in the CLI config.

Related errors


AI-assisted analysis of juanfont/headscale@565fd254d0 (2026-08-15). Data as JSON: /api/errors/39766dac9c515780. Report an issue: GitHub.