{"record":{"id":"9ee0fd3ce3a4330f","repo":"reflex-dev/reflex","slug":"invalid-toml-file-format-at-pyproject-path-expe-9ee0fd","errorCode":null,"errorMessage":"Invalid TOML file format at {pyproject_path}. Expected 'tool.reflex-cloud' to be present.","messagePattern":"Invalid TOML file format at (.+?)\\. Expected 'tool\\.reflex-cloud' to be present\\.","errorType":"validation","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"packages/reflex-hosting-cli/src/reflex_cli/core/config.py","lineNumber":271,"sourceCode":"            import tomllib\n        except ImportError as e:\n            raise ConfigError(\n                \"TOML support is not available. Please use Python 3.11 or later.\"\n            ) from e\n\n        with pyproject_path.open(\"rb\") as file:\n            pyproject_data = tomllib.load(file)\n            if not isinstance(pyproject_data, dict):\n                raise ConfigError(\n                    f\"Invalid TOML file format at {pyproject_path}. Expected a dictionary.\"\n                )\n            tools = pyproject_data.get(\"tool\", {})\n            if not isinstance(tools, dict):\n                raise ConfigError(\n                    f\"Invalid TOML file format at {pyproject_path}. Expected 'tool' to be a dictionary.\"\n                )\n            if \"reflex-cloud\" not in tools:\n                raise ConfigError(\n                    f\"Invalid TOML file format at {pyproject_path}. Expected 'tool.reflex-cloud' to be present.\"\n                )\n            data = tools[\"reflex-cloud\"]\n            if env:\n                data = data.get(\"env\", {}).get(env, {})\n            data = cls._filter_dict(data)\n        return cls(_cloud_config_path=pyproject_path, **data)\n\n    @classmethod\n    def from_yaml_or_toml_or_default(cls) -> Config:\n        \"\"\"Creates a Config instance from either a YAML or TOML file, or returns a default instance.\n\n        Returns:\n            Config: A Config instance with values from the YAML or TOML file, or a default instance if neither file exists.\n\n        \"\"\"\n        return cls.from_yaml_or_toml_or_none() or cls()\n","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-hosting-cli/src/reflex_cli/core/config.py#L253-L289","documentation":"ConfigError raised when the [tool.reflex-cloud] table is absent from pyproject.toml. The TOML loader requires this section to hold the CLI's cloud configuration, so a pyproject.toml without it cannot provide config.","triggerScenarios":"CloudConfig.from_toml on a pyproject.toml that has a [tool] table (or other tool.* sections) but no [tool.reflex-cloud] entry; env sub-lookup also fails here when the table is missing.","commonSituations":"Using a generic Python pyproject.toml in a Reflex project without adding the reflex-cloud section; config resolution falling through to TOML when you expected it to use rxconfig.yaml.","solutions":["Add a [tool.reflex-cloud] section (can be empty) to pyproject.toml","Or ensure rxconfig.yaml exists so from_yaml_or_toml_or_none loads YAML config instead"],"exampleFix":"# before (pyproject.toml)\n[tool.ruff]\nline-length = 100\n\n# after\n[tool.ruff]\nline-length = 100\n\n[tool.reflex-cloud]\nteardown_on_delete = true","handlingStrategy":"validation","validationCode":"import tomllib\nparsed = tomllib.loads(Path(\"pyproject.toml\").read_text())\nif \"reflex-cloud\" not in parsed.get(\"tool\", {}):\n    parsed.setdefault(\"tool\", {})['reflex-cloud'] = {}  # add empty section\n# now safe to load","typeGuard":"def has_reflex_cloud_section(parsed: dict) -> bool:\n    return \"reflex-cloud\" in parsed.get(\"tool\", {})","tryCatchPattern":"try:\n    config = CloudConfig.from_toml(p)\nexcept ConfigError as e:\n    if \"tool.reflex-cloud\" in str(e):\n        add_empty_reflex_cloud_section(p)\n        config = CloudConfig.from_toml(p)\n    else:\n        raise","preventionTips":["Add [tool.reflex-cloud] to pyproject.toml when using TOML config","If you rely on rxconfig.yaml, ensure that file exists so YAML is preferred"],"tags":["config","toml","missing-section","reflex-hosting-cli"],"backgroundTag":"config-missing-section","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}