{"record":{"id":"0791639cbcf80efa","repo":"reflex-dev/reflex","slug":"app-name-should-be-a-string","errorCode":null,"errorMessage":"app_name should be a string","messagePattern":"app_name should be a string","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py","lineNumber":956,"sourceCode":"        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.\n        client: The authenticated client\n        provider: The hosting provider to pin the app to (e.g. \"gcp\"). ``None``\n            keeps the Reflex Cloud default.\n\n    Returns:\n        dict: The created application details as a dictionary.\n\n    Raises:\n        NotAuthenticatedError: If the token is not valid.\n        ValueError: If forbidden.\n\n    \"\"\"\n    import httpx\n\n    if not isinstance(app_name, str) or not app_name:\n        raise ValueError(\"app_name should be a string\")\n    if not isinstance(client, AuthenticatedClient):\n        raise NotAuthenticatedError(\"not authenticated\")\n    payload: dict[str, Any] = {\n        \"name\": app_name,\n        \"description\": description,\n        \"project\": project_id,\n    }\n    if provider is not None:\n        payload[\"provider\"] = provider\n    response = httpx.post(\n        urljoin(constants.Hosting.HOSTING_SERVICE, \"/api/v1/apps/\"),\n        json=payload,\n        headers=authorization_header(client.token),\n        timeout=constants.Hosting.TIMEOUT,\n    )\n    if response.status_code == HTTPStatus.FORBIDDEN:\n        logger.debug(f\"Server responded with 403: {response.text}\")\n        raise ValueError(f\"{response.text}\")","sourceCodeStart":938,"sourceCodeEnd":974,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-hosting-cli/src/reflex_cli/utils/hosting.py#L938-L974","documentation":"Raised by create_app() when app_name is not a non-empty string. The name becomes the 'name' field of the POST /api/v1/apps payload, so the library validates it up front rather than letting the backend reject the request. Typically hit when passing None, an empty string, or a non-str value from config or CLI options.","triggerScenarios":"Calling create_app() (used by deploy and directly in tests) with app_name=None, \"\", or a non-string — e.g. reading rxconfig.yaml's app_name into the wrong variable, or a CLI flag left unset.","commonSituations":"rxconfig.yaml has a missing/empty app_name; scripted deploy passes a falsy name; refactoring renamed the variable holding the name.","solutions":["Set a valid non-empty string app name in rxconfig.yaml (app_name = \"my-app\") or pass it explicitly to create_app()","Check the value is truthy before deploying: assert isinstance(app_name, str) and app_name","If the name comes from user input, strip and validate it before calling create_app"],"exampleFix":"# before\napp = create_app(client, app_name=None, project_id=proj_id)\n\n# after\napp_name = config.app_name or \"my-default-app\"\napp = create_app(client, app_name=app_name, project_id=proj_id)","handlingStrategy":"validation","validationCode":"app_name = (app_name or config.app_name or \"\").strip()\nif not app_name:\n    raise ValueError(\"app_name is required before deploy\")\ncreate_app(client, app_name=app_name, project_id=project_id)","typeGuard":"def is_valid_app_name(name: object) -> bool:\n    return isinstance(name, str) and bool(name.strip())","tryCatchPattern":"try:\n    create_app(client, app_name, project_id)\nexcept ValueError as ex:\n    if \"app_name\" in str(ex):\n        app_name = config.app_name\n        create_app(client, app_name, project_id)\n    else:\n        raise","preventionTips":["Set app_name in rxconfig.yaml so deploy always has a valid name","Validate names at the edge (CLI/config load), not at the API boundary"],"tags":["validation","argument","hosting","reflex-cli","deploy"],"backgroundTag":"invalid-argument-value","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}