{"record":{"id":"e6afb8bc45fb95a9","repo":"juanfont/headscale","slug":"destroying-user-w","errorCode":null,"errorMessage":"destroying user: %w","messagePattern":"destroying user: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/users.go","lineNumber":173,"sourceCode":"\tUse:     \"destroy --identifier ID or --name NAME\",\n\tShort:   \"Destroys a user\",\n\tAliases: []string{cmdDelete},\n\tRunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {\n\t\t_, user, err := resolveSingleUser(ctx, client, cmd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !confirmAction(cmd, fmt.Sprintf(\n\t\t\t\"Do you want to remove the user %q (%s) and any associated preauthkeys?\",\n\t\t\tuser.Name, user.Id,\n\t\t)) {\n\t\t\treturn printOutput(cmd, map[string]string{colResult: \"User not destroyed\"}, \"User not destroyed\")\n\t\t}\n\n\t\tresp, err := client.DeleteUserWithResponse(ctx, user.Id)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"destroying user: %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, \"User destroyed\")\n\t}),\n}\n\nvar listUsersCmd = &cobra.Command{\n\tUse:     cmdList,\n\tShort:   \"List all the users\",\n\tAliases: []string{\"ls\", cmdShow},\n\tRunE: clientRunE(func(ctx context.Context, client *clientv1.ClientWithResponses, cmd *cobra.Command, args []string) error {\n\t\tparams := &clientv1.ListUsersParams{}\n\n\t\tid, _ := cmd.Flags().GetInt64(\"identifier\")","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/users.go#L155-L191","documentation":"Error \"destroying user: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at cmd/headscale/cli/users.go:173 when the library encounters an invalid state.","commonSituations":"Destroying the user failed. Ensure the user exists and has no remaining nodes registered.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (destroying user); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (destroying user); retry the operation after fixing the input, configuration, or environment.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"565fd254d06c4c7f9a8cad1714a43445c79ba420","analyzedAt":"2026-08-15T13:12:30.133Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}