{"record":{"id":"0465199c0439909e","repo":"crewAIInc/crewAI","slug":"failed-to-retrieve-organization-list-e-s","errorCode":null,"errorMessage":"Failed to retrieve organization list: {e!s}","messagePattern":"Failed to retrieve organization list: (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"lib/cli/src/crewai_cli/organization/main.py","lineNumber":46,"sourceCode":"\n            table = Table(title=\"Your Organizations\")\n            table.add_column(\"Name\", style=\"cyan\")\n            table.add_column(\"ID\", style=\"green\")\n            for org in orgs:\n                table.add_row(org[\"name\"], org[\"uuid\"])\n\n            console.print(table)\n        except HTTPStatusError as e:\n            if e.response.status_code == 401:\n                console.print(\n                    \"You are not logged in to any organization. Use 'crewai login' to login.\",\n                    style=\"bold red\",\n                )\n                return\n            console.print(\n                f\"Failed to retrieve organization list: {e!s}\", style=\"bold red\"\n            )\n            raise SystemExit(1) from e\n        except Exception as e:\n            console.print(\n                f\"Failed to retrieve organization list: {e!s}\", style=\"bold red\"\n            )\n            raise SystemExit(1) from e\n\n    def switch(self, org_id: str) -> None:\n        try:\n            response = self.plus_api_client.get_organizations()\n            response.raise_for_status()\n            orgs = response.json()\n\n            org = next((o for o in orgs if o[\"uuid\"] == org_id), None)\n            if not org:\n                console.print(\n                    f\"Organization with id '{org_id}' not found.\", style=\"bold red\"\n                )\n                return","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/cli/src/crewai_cli/organization/main.py#L28-L64","documentation":"Printed by `crewai org list` when the organizations API call returns an HTTP error status other than 401 (401 is handled separately as 'not logged in'). The message embeds the HTTPStatusError text (status code + URL) and the command exits 1. It means authentication succeeded but the Plus API rejected the request — 403/404/500 etc.","triggerScenarios":"Running `crewai org list` (or OrganizationCommand.list) when the Plus API returns 403 (account lacks org access), 404 (endpoint moved / stale CLI against old API), 429, or 5xx — any raise_for_status() failure that is not 401.","commonSituations":"Expired feature entitlements or suspended accounts, CLI version skew with API changes, CrewAI Plus incidents, or organization membership revoked while the token remains valid.","solutions":["Read the status code in the message: 403 → check your plan/entitlements on crewai.com; 5xx → retry later or check status page","Update the CLI: uv tool upgrade crewai (or pip install -U crewai) to clear endpoint version skew","Re-login (`crewai logout && crewai login`) to refresh tokens if the API reports auth-adjacent 403","If persistent, capture `crewai org list` output and contact CrewAI support with the status code"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"import httpx\n\ndef org_api_ok(client_base_url: str, headers: dict) -> bool:\n    try:\n        r = httpx.get(f\"{client_base_url}/organizations\", headers=headers, timeout=15)\n        return r.status_code < 400 or r.status_code == 401\n    except httpx.HTTPError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    org_cmd.list()\nexcept SystemExit:\n    # message already printed; inspect it for the HTTP status before deciding\n    raise","preventionTips":["Keep the CLI updated to match the current Plus API","Treat 5xx/429 as transient — retry after a backoff","Re-login after account/plan changes to refresh token claims"],"tags":["api","organizations","http","cli"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}