{"record":{"id":"2c67213d6bc086a8","repo":"reflex-dev/reflex","slug":"detail","errorCode":null,"errorMessage":"detail","messagePattern":"detail","errorType":"http","errorClass":"GetAppError","httpStatus":null,"severity":"error","filePath":"packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py","lineNumber":922,"sourceCode":"        ValueError: If the app_id is not valid.\n\n    \"\"\"\n    import httpx\n\n    if not isinstance(client, AuthenticatedClient):\n        raise NotAuthenticatedError(\"not authenticated\")\n    if not isinstance(app_id, str) or not app_id:\n        raise ValueError(\"app_id should be a string\")\n    response = httpx.get(\n        urljoin(constants.Hosting.HOSTING_SERVICE, f\"/api/v1/apps/{app_id}\"),\n        headers=authorization_header(client.token),\n        timeout=constants.Hosting.TIMEOUT,\n    )\n    try:\n        response.raise_for_status()\n    except httpx.HTTPStatusError as ex:\n        try:\n            raise GetAppError(ex.response.json().get(\"detail\")) from ex\n        except json.JSONDecodeError:\n            raise GetAppError(ex.response.text) from ex\n    return response.json()\n\n\ndef create_app(\n    app_name: str,\n    client: AuthenticatedClient,\n    description: str,\n    project_id: str | None,\n    provider: str | None = None,\n):\n    \"\"\"Create a new application.\n\n    Args:\n        app_name: The name of the application.\n        description: The description of the application.\n        project_id: The ID of the project to associate the application with.","sourceCodeStart":904,"sourceCodeEnd":940,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py#L904-L940","documentation":"Raised by get_app() when GET /api/v1/apps/{app_id} returns a non-2xx status. The library parses the server's JSON body and re-raises GetAppError with its 'detail' field (falling back to the raw response text if the body is not JSON). So the message you see is whatever the hosting service reported — most often 'app not found' or an auth/permission error.","triggerScenarios":"Calling get_app(), delete_app(), or get_app_logs() with an app_id that does not exist (404 detail), a token lacking access to the app (401/403), or while the hosting service returns 5xx. The message is the server's 'detail' value, hence the generic-looking 'detail' name.","commonSituations":"App was deleted on the cloud console but the id is still cached locally; wrong project/org token; typo'd or truncated app_id; stale id after re-deploying under a new app.","solutions":["Verify the app_id exists: list apps (list_apps) and confirm the id before calling get_app","If the detail says unauthenticated/forbidden, re-run `reflex login` and confirm your account has access to the app's project","Catch reflex_cli.utils.exceptions.GetAppError and handle missing apps explicitly instead of letting it crash"],"exampleFix":"from reflex_cli.utils.exceptions import GetAppError\n\n# before\napp = get_app(client, app_id)\n\n# after\ntry:\n    app = get_app(client, app_id)\nexcept GetAppError as ex:\n    if \"not found\" in str(ex):\n        logger.warning(f\"app {app_id} no longer exists\")\n        app = None\n    else:\n        raise","handlingStrategy":"try-catch","validationCode":"apps = {a[\"name\"]: a[\"id\"] for a in (list_apps(client) or [])}\nif app_id not in apps.values():\n    raise LookupError(f\"unknown app_id {app_id}\")","typeGuard":null,"tryCatchPattern":"from reflex_cli.utils.exceptions import GetAppError\ntry:\n    app = get_app(client, app_id)\nexcept GetAppError as ex:\n    if \"not found\" in str(ex).lower():\n        app = None  # treat as deleted\n    else:\n        raise","preventionTips":["Refresh the app id from list_apps instead of caching ids across sessions","Treat GetAppError with 'not found' as an expected outcome in cleanup/delete scripts","Log the detail message — it distinguishes auth failures from missing apps"],"tags":["http","hosting","get-app","api-error","reflex-cli"],"backgroundTag":"resource-not-found","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}