{"record":{"id":"91d647f177be34a0","repo":"juanfont/headscale","slug":"listing-users-w","errorCode":null,"errorMessage":"listing users: %w","messagePattern":"listing users: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/headscale/cli/users.go","lineNumber":69,"sourceCode":") (uint64, *clientv1.User, error) {\n\tid, username, err := usernameAndIDFromFlag(cmd)\n\tif err != nil {\n\t\treturn 0, nil, err\n\t}\n\n\tparams := &clientv1.ListUsersParams{}\n\tif username != \"\" {\n\t\tparams.Name = &username\n\t}\n\n\tif id != 0 {\n\t\tidStr := strconv.FormatUint(id, util.Base10)\n\t\tparams.Id = &idStr\n\t}\n\n\tresp, err := client.ListUsersWithResponse(ctx, params)\n\tif err != nil {\n\t\treturn 0, nil, fmt.Errorf(\"listing users: %w\", err)\n\t}\n\n\tif resp.StatusCode() != http.StatusOK {\n\t\treturn 0, nil, apiError(resp.StatusCode(), resp.ApplicationproblemJSONDefault)\n\t}\n\n\tusers := resp.JSON200.Users\n\tif len(users) != 1 {\n\t\treturn 0, nil, errMultipleUsersMatch\n\t}\n\n\treturn id, &users[0], nil\n}\n\nfunc init() {\n\trootCmd.AddCommand(userCmd)\n\tuserCmd.AddCommand(createUserCmd)\n\tcreateUserCmd.Flags().StringP(\"display-name\", \"d\", \"\", \"Display name\")","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/juanfont/headscale/blob/565fd254d06c4c7f9a8cad1714a43445c79ba420/cmd/headscale/cli/users.go#L51-L87","documentation":"Error \"listing users: %w\" thrown in juanfont/headscale.","triggerScenarios":"Thrown at cmd/headscale/cli/users.go:69 when the library encounters an invalid state.","commonSituations":"The gRPC ListUsers call failed. Check server connectivity and that the CLI API key or socket permissions are valid.","solutions":["Inspect the wrapped error for the underlying cause and correct the failing condition (listing users); retry the operation after fixing the input, configuration, or environment."],"exampleFix":"Inspect the wrapped error for the underlying cause and correct the failing condition (listing users); 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"}