{"record":{"id":"2b38202befceae05","repo":"plandex-ai/plandex","slug":"error-fetching-users-s-2b3820","errorCode":null,"errorMessage":"error fetching users: %s","messagePattern":"error fetching users: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/cmd/users.go","lineNumber":41,"sourceCode":"\tRootCmd.AddCommand(usersCmd)\n}\n\nfunc listUsersAndInvites(cmd *cobra.Command, args []string) {\n\tauth.MustResolveAuthWithOrg()\n\n\tvar userResp *shared.ListUsersResponse\n\tvar pendingInvites []*shared.Invite\n\tvar orgRoles []*shared.OrgRole\n\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\tgo func() {\n\t\tvar err *shared.ApiError\n\t\torgRoles, err = api.Client.ListOrgRoles()","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/cmd/users.go#L23-L59","documentation":"This error wraps a failure from api.Client.ListUsers() in the users command's parallel fetch. The *shared.ApiError Msg is interpolated into 'error fetching users: %s'. It means the org user listing failed (auth, network, or server error), so the users command cannot display members.","triggerScenarios":"ListUsers() returning non-nil *shared.ApiError while the users command runs: invalid/expired API key, network outage, insufficient org permissions, or 4xx/5xx server response.","commonSituations":"Logged-out or expired CLI session; role without member-list permission; VPN/proxy blocking the API; API incident.","solutions":["Re-authenticate (login flow) to refresh credentials","Confirm your org role allows listing users","Check network/proxy reachability to the API host","Inspect err.Msg in the message for the exact status code 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 (credentials expired — run `auth login`)\", err.Msg)\n} else {\n\terrCh <- fmt.Errorf(\"error fetching users: %s\", err.Msg)\n}","handlingStrategy":"type-guard","validationCode":"// pre-flight: confirm credentials before listing users\nif api.Client == nil || api.Client.APIKey == \"\" {\n\treturn fmt.Errorf(\"not authenticated: run the login command first\")\n}","typeGuard":"func toApiError(err error) (*shared.ApiError, bool) {\n\tae, ok := err.(*shared.ApiError)\n\treturn ae, ok\n}","tryCatchPattern":"userResp, err := api.Client.ListUsers()\nif err != nil {\n\tif ae, ok := err.(*shared.ApiError); ok {\n\t\tswitch ae.Status {\n\t\tcase 401: return reauthAndRetry()\n\t\tcase 403: return fmt.Errorf(\"insufficient permissions to list users\")\n\t\t}\n\t}\n\treturn fmt.Errorf(\"error fetching users: %w\", err)\n}","preventionTips":["Authenticate before running org-scoped commands","Map 401/403 to actionable messages (re-login, permissions)","Retry transient server errors with backoff","Verify corporate proxy/firewall allows the API host"],"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-14T00:17:10.932Z"}