{"record":{"id":"37a137cf8376e3b6","repo":"juanfont/headscale","slug":"registering-node-w","errorCode":null,"errorMessage":"registering node: %w","messagePattern":"registering node: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/auth.go","lineNumber":46,"sourceCode":"\nvar authCmd = &cobra.Command{\n\tUse:   \"auth\",\n\tShort: \"Manage node authentication and approval\",\n}\n\nvar authRegisterCmd = &cobra.Command{\n\tUse:   \"register\",\n\tShort: \"Register a node to your network\",\n\tRunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {\n\t\tuser, _ := cmd.Flags().GetString(\"user\")\n\t\tauthID, _ := cmd.Flags().GetString(\"auth-id\")\n\n\t\tresp, err := client.AuthRegisterWithResponse(ctx, clientv1.AuthRegisterJSONRequestBody{\n\t\t\tAuthId: &authID,\n\t\t\tUser:   &user,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"registering node: %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\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\",","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/auth.go#L28-L64","documentation":"Transport error from 'headscale nodes register' (authRegisterCmd): client.AuthRegisterWithResponse failed before receiving an HTTP response. This is the CLI path that approves a pending registration and assigns it to a user; failure here means connectivity to the server, not registration semantics.","triggerScenarios":"'headscale nodes register --user X' with the server unreachable, TLS misconfigured, or the command cancelled before the request completed.","commonSituations":"Registering a node while headscale is restarting; CLI socket/address config wrong after a config change; CI environments without a reachable server.","solutions":["Confirm the server is running and reachable ('headscale health')","Check CLI address and CA configuration","Retry the register once the server is stable — registration requests are idempotent per pending auth key"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"if _, err := client.AuthRegisterWithResponse(ctx, body); err != nil {\n\tif isTransportError(err) { /* reconnect and retry; registration stays pending server-side */ }\n}","preventionTips":["Verify connectivity before approving registrations in scripts","Keep the auth-id valid window in mind — re-check pending requests after outages"],"tags":["network","http-client","cli","registration","go"],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}