{"record":{"id":"0058190cfab538d8","repo":"plandex-ai/plandex","slug":"error-fetching-org-roles-s","errorCode":null,"errorMessage":"error fetching org roles: %s","messagePattern":"error fetching org roles: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/cli/cmd/users.go","lineNumber":61,"sourceCode":"\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()\n\t\tif err != nil {\n\t\t\terrCh <- fmt.Errorf(\"error fetching org roles: %s\", err.Msg)\n\t\t\treturn\n\t\t}\n\t\terrCh <- nil\n\n\t}()\n\n\tfor i := 0; i < 3; i++ {\n\t\terr := <-errCh\n\t\tif err != nil {\n\t\t\tterm.StopSpinner()\n\t\t\tterm.OutputErrorAndExit(\"%v\", err)\n\t\t}\n\t}\n\n\tterm.StopSpinner()\n\n\torgRolesById := make(map[string]*shared.OrgRole)\n\tfor _, role := range orgRoles {","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/cli/cmd/users.go#L43-L79","documentation":"This error wraps a failure from api.Client.ListOrgRoles() in the users command's third parallel fetch goroutine. The *shared.ApiError Msg is interpolated into 'error fetching org roles: %s'. It means the org-role listing failed, so the users command cannot render role assignments.","triggerScenarios":"ListOrgRoles() returning non-nil *shared.ApiError: invalid/expired credentials, insufficient permissions to list roles, network failure, or server 4xx/5xx response.","commonSituations":"Accounts without admin/role-read permissions; expired session tokens; API outages; proxy/firewall blocking requests.","solutions":["Re-authenticate to refresh credentials","Confirm your role can list org roles (ask an admin if not)","Check network/proxy connectivity to the API host","Read the embedded err.Msg for the HTTP status and handle accordingly"],"exampleFix":"// before\nerrCh <- fmt.Errorf(\"error fetching org roles: %s\", err.Msg)\n// after\nif err.Status == 403 {\n\terrCh <- fmt.Errorf(\"error fetching org roles: %s (insufficient permissions)\", err.Msg)\n} else {\n\terrCh <- fmt.Errorf(\"error fetching org roles: %s\", err.Msg)\n}","handlingStrategy":"type-guard","validationCode":"// pre-flight: confirm the account can read org roles before invoking the command\nif api.Client == nil || api.Client.Token == \"\" {\n\treturn fmt.Errorf(\"not authenticated\")\n}\n// optionally probe permission via a lighter endpoint first","typeGuard":"func isApiError(err error) (*shared.ApiError, bool) {\n\tae, ok := err.(*shared.ApiError)\n\treturn ae, ok\n}","tryCatchPattern":"orgRoles, err := api.Client.ListOrgRoles()\nif err != nil {\n\tif ae, ok := err.(*shared.ApiError); ok {\n\t\tif ae.Status == 403 {\n\t\t\treturn fmt.Errorf(\"your role cannot list org roles; contact an admin\")\n\t\t}\n\t\tif ae.Status == 401 {\n\t\t\treturn reauthAndRetry()\n\t\t}\n\t}\n\treturn fmt.Errorf(\"error fetching org roles: %w\", err)\n}","preventionTips":["Verify role-read permissions before running users commands","Auto-refresh expired tokens on 401","Retry transient 5xx failures","Confirm network access to the API endpoint"],"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"}