{"record":{"id":"1dbea116099ceea6","repo":"plandex-ai/plandex","slug":"error-fetching-users-s","errorCode":null,"errorMessage":"error fetching users: %s","messagePattern":"error fetching users: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/cmd/revoke.go","lineNumber":43,"sourceCode":"func revoke(cmd *cobra.Command, args []string) {\n\tauth.MustResolveAuthWithOrg()\n\n\temail := \"\"\n\tif len(args) > 0 {\n\t\temail = args[0]\n\t}\n\n\tvar userResp *shared.ListUsersResponse\n\tvar pendingInvites []*shared.Invite\n\terrCh := make(chan error)\n\n\tterm.StartSpinner(\"\")\n\n\tgo func() {\n\t\tvar err *shared.ApiError\n\t\tuserResp, err = api.Client.ListUsers()\n\t\tif err != nil {\n\t\t\terrCh <- fmt.Errorf(\"error fetching users: %s\", err.Msg)\n\t\t\treturn\n\t\t}\n\t\terrCh <- nil\n\t}()\n\n\tgo func() {\n\t\tvar err *shared.ApiError\n\t\tpendingInvites, err = api.Client.ListPendingInvites()\n\t\tif err != nil {\n\t\t\terrCh <- fmt.Errorf(\"error fetching pending invites: %s\", err.Msg)\n\t\t\treturn\n\t\t}\n\t\terrCh <- nil\n\t}()\n\n\tfor i := 0; i < 2; i++ {\n\t\terr := <-errCh\n\t\tif err != nil {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/cmd/revoke.go#L25-L61","documentation":"This error wraps a failure from api.Client.ListUsers() when the CLI fetches the organization's user list in a background goroutine. The client returns *shared.ApiError, and its Msg field is interpolated into 'error fetching users: %s'. It signals the API call for listing users failed (network, auth, or server-side), so the revoke command aborts before it can present users for selection.","triggerScenarios":"Calling the revoke command while ListUsers() returns a non-nil *shared.ApiError: invalid or expired API key, network outage, org ID not set, or the API returning 4xx/5xx. The goroutine sends the wrapped error to errCh and the command exits.","commonSituations":"Expired session token after a long-lived CLI session; running the command without being logged in; corporate proxy blocking the API host; user lacking permissions to list org members.","solutions":["Run the auth/login flow again to refresh the API key or session token","Verify network connectivity and proxy settings can reach the API host","Confirm the CLI is pointed at the correct org and the account has member-list permissions","Check the underlying err.Msg printed in the message for the exact HTTP status and act on it"],"exampleFix":"// before\nerrCh <- fmt.Errorf(\"error fetching users: %s\", err.Msg)\n// after\nif err.Status == 401 {\n\terrCh <- fmt.Errorf(\"error fetching users: %s (run `auth login` to refresh credentials)\", err.Msg)\n} else {\n\terrCh <- fmt.Errorf(\"error fetching users: %s\", err.Msg)\n}","handlingStrategy":"type-guard","validationCode":"// pre-flight: ensure credentials and connectivity before invoking the command\nif api.Client == nil || api.Client.APIKey == \"\" {\n\treturn fmt.Errorf(\"not authenticated: run the login command first\")\n}\nif err := api.Client.Ping(); err != nil {\n\treturn fmt.Errorf(\"API unreachable: %w\", err)\n}","typeGuard":"func isApiError(err error) (*shared.ApiError, bool) {\n\tif ae, ok := err.(*shared.ApiError); ok {\n\t\treturn ae, true\n\t}\n\treturn nil, false\n}","tryCatchPattern":"userResp, err := api.Client.ListUsers()\nvar apiErr *shared.ApiError\nif err != nil {\n\tif ae, ok := err.(*shared.ApiError); ok { apiErr = ae }\n\tif apiErr != nil && apiErr.Status == 401 {\n\t\treturn reauthAndRetry()\n\t}\n\treturn fmt.Errorf(\"error fetching users: %w\", err)\n}","preventionTips":["Run the login/auth command before org commands and refresh tokens on a schedule","Check err.Msg/status codes and handle 401 with automatic re-auth","Verify network/proxy access to the API host in CI environments","Fail fast with a clear message when the client is unauthenticated"],"tags":["go","cli","api","network"],"backgroundTag":"api-request-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}