{"record":{"id":"baa02b42e8ed8422","repo":"juanfont/headscale","slug":"approving-auth-request-w","errorCode":null,"errorMessage":"approving auth request: %w","messagePattern":"approving auth request: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/auth.go","lineNumber":71,"sourceCode":"\t\tnode := resp.JSON200.Node\n\n\t\treturn printOutput(\n\t\t\tcmd,\n\t\t\tnode,\n\t\t\tfmt.Sprintf(\"Node %s registered\", node.GivenName),\n\t\t)\n\t}),\n}\n\nvar authApproveCmd = &cobra.Command{\n\tUse:   \"approve\",\n\tShort: \"Approve a pending authentication request\",\n\tRunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {\n\t\tauthID, _ := cmd.Flags().GetString(\"auth-id\")\n\n\t\tresp, err := client.AuthApproveWithResponse(ctx, clientv1.AuthApproveJSONRequestBody{AuthId: &authID})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"approving auth request: %w\", err)\n\t\t}\n\n\t\tif resp.StatusCode() != http.StatusOK {\n\t\t\treturn apiError(resp.StatusCode(), resp.ApplicationproblemJSONDefault)\n\t\t}\n\n\t\treturn printOutput(cmd, resp.JSON200, \"Auth request approved\")\n\t}),\n}\n\nvar authRejectCmd = &cobra.Command{\n\tUse:   \"reject\",\n\tShort: \"Reject a pending authentication request\",\n\tRunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {\n\t\tauthID, _ := cmd.Flags().GetString(\"auth-id\")\n\n\t\tresp, err := client.AuthRejectWithResponse(ctx, clientv1.AuthRejectJSONRequestBody{AuthId: &authID})\n\t\tif err != nil {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/auth.go#L53-L89","documentation":"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.","triggerScenarios":"'headscale auth approve --auth-id ...' while the server is down, TLS trust is broken, or the request times out.","commonSituations":"Node registration automation where the server restarts between the node's login attempt and the admin's approval; misconfigured CLI endpoint.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := client.AuthApproveWithResponse(ctx, body); err != nil {\n\tif isTransportError(err) { retryOnce() } else { return err }\n}","preventionTips":["Approve promptly while the auth request is fresh","Confirm the auth-id exists before approving in automation"],"tags":["network","http-client","cli","auth","go"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}