{"record":{"id":"8eaab3aabc12c150","repo":"reflex-dev/reflex","slug":"project-search-failed-ex-details","errorCode":null,"errorMessage":"project search failed: {ex_details}","messagePattern":"project search failed: (.+?)","errorType":"http","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py","lineNumber":868,"sourceCode":"    import httpx\n\n    if not isinstance(client, AuthenticatedClient):\n        raise NotAuthenticatedError(\"not authenticated\")\n\n    response = httpx.get(\n        urljoin(constants.Hosting.HOSTING_SERVICE, \"/api/v1/project/search\"),\n        params={\"project_name\": project_name},\n        headers=authorization_header(client.token),\n        timeout=constants.Hosting.TIMEOUT,\n    )\n\n    try:\n        response.raise_for_status()\n    except httpx.HTTPStatusError as ex:\n        if response.status_code == HTTPStatus.NOT_FOUND:\n            return None\n        ex_details = ex.response.json().get(\"detail\")\n        raise Exception(f\"project search failed: {ex_details}\") from ex\n\n    projects = response.json()\n\n    if len(projects) > 1 and not interactive:\n        logger.error(\n            f\"Multiple projects with the name {project_name!r} found. Please provide a unique name.\"\n        )\n        raise click.exceptions.Exit(1)\n\n    if len(projects) > 1 and interactive:\n        return interactive_resolve_project_or_app_name_conflicts(\n            projects,\n            rows=[[f\"({i})\", x[\"id\"], x[\"name\"]] for i, x in enumerate(projects)],\n            headers=[\"\", \"Project ID\", \"Project name\"],\n            conflict_warn_msg=\"Found multiple projects with the same name. Select one to continue\",\n            conflict_ask_msg=\"Which project would you like to use?\",\n        )\n    if len(projects) == 1:","sourceCodeStart":850,"sourceCodeEnd":886,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py#L850-L886","documentation":"Raised by search_project() when the GET /api/v1/project/search request returns a non-2xx status other than 404 (404 means 'no such project' and returns None). The message embeds the server's JSON 'detail' field, so the exact text comes from the hosting service (e.g. validation errors, 401/403 auth failures, 5xx outages). Note it raises a bare Exception, not a library-specific type.","triggerScenarios":"Any HTTP error from the project search endpoint except 404: expired/revoked token (401), no access to the named project (403), malformed project_name the backend rejects (422), or hosting service downtime (5xx). Reachable through list_apps, deploy, select_project, get_project_roles, get_project_role_permissions, get_project_role_users.","commonSituations":"Token expired between login and the call; pointing constants.Hosting.HOSTING_SERVICE at a wrong/custom URL; hosting service incident; project name containing characters the API rejects.","solutions":["Re-authenticate (`reflex login`) and retry — expired tokens are the most common cause of a 401 detail","Inspect the detail text: it is the server's JSON 'detail' field and states the actual reason (auth, permission, validation)","Check the hosting service status / HOSTING_SERVICE URL configuration if detail suggests 5xx or connectivity issues","Catch Exception around search_project in scripts (it is a bare Exception) and surface the detail to the user"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    projects = search_project(client, project_name)\nexcept Exception as ex:  # library raises bare Exception\n    if \"401\" in str(ex) or \"Unauthorized\" in str(ex):\n        client = authenticate()\n        projects = search_project(client, project_name)\n    else:\n        raise","preventionTips":["Refresh tokens before long-running scripts so they don't lapse mid-run","Surface the server 'detail' text to users — it contains the actual failure reason","Add retry-with-backoff for transient 5xx from the hosting service"],"tags":["http","hosting","api-error","reflex-cli","project-search"],"backgroundTag":"api-request-failed","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}