reflex-dev/reflex · error · ConfigError
Config file not found at {pyproject_path}.
Error message
Config file not found at {pyproject_path}. What it means
ConfigError raised by CloudConfig.from_toml when the given TOML/pyproject.toml path does not exist. The CLI reads cloud settings from the [tool.reflex-cloud] section of pyproject.toml, and this error means that file is missing.
Source
Thrown at packages/reflex-hosting-cli/src/reflex_cli/core/config.py:250
cls,
pyproject_path: Path = Path.cwd() / "pyproject.toml",
env: str | None = None,
) -> Config:
"""Creates a Config instance from a TOML file.
Args:
pyproject_path: The path to the TOML file. Defaults to "pyproject.toml" in the current directory.
env: The environment to load the config for.
Returns:
Config: A Config instance with the values from the TOML file.
Raises:
ConfigError: If the TOML file is not found.
"""
if not pyproject_path.exists():
raise ConfigError(f"Config file not found at {pyproject_path}.")
try:
import tomllib
except ImportError as e:
raise ConfigError(
"TOML support is not available. Please use Python 3.11 or later."
) from e
with pyproject_path.open("rb") as file:
pyproject_data = tomllib.load(file)
if not isinstance(pyproject_data, dict):
raise ConfigError(
f"Invalid TOML file format at {pyproject_path}. Expected a dictionary."
)
tools = pyproject_data.get("tool", {})
if not isinstance(tools, dict):
raise ConfigError(
f"Invalid TOML file format at {pyproject_path}. Expected 'tool' to be a dictionary."View on GitHub (pinned to 45b8ed5ab7)
Solutions
- Run the command from your project root containing pyproject.toml, or create one
- Verify the path passed/derived for pyproject.toml has no typos
- If you use rxconfig.yaml instead, make sure that file exists so resolution picks YAML
Example fix
# before
config = CloudConfig.from_toml(Path("pyproject.toml")) # run from wrong dir
# after
cd /path/to/project && reflex deploy # pyproject.toml present Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
p = Path("pyproject.toml")
if not p.exists():
raise FileNotFoundError(f"missing {p}")
config = CloudConfig.from_toml(p) Try / catch
try:
config = CloudConfig.from_toml(p)
except ConfigError as e:
if "not found" in str(e):
config = CloudConfig()
else:
raise Prevention
- Run hosting commands from the project root containing pyproject.toml
- Verify the resolved config path before calling from_toml
- Keep pyproject.toml under version control so it can't go missing
When it happens
Trigger: Calling CloudConfig.from_toml(path) with a non-existent path, or a hosting command whose config resolution (from_yaml_or_toml_or_none) lands on a pyproject.toml that isn't there.
Common situations: Running the hosting CLI outside a Reflex project directory (no pyproject.toml present); a typo in a custom config path; the project file was renamed or deleted.
Related errors
- f"Config file not found at {yaml_path}."
- Invalid TOML file format at {pyproject_path}. Expected a dic
- Invalid TOML file format at {pyproject_path}. Expected 'tool
- Invalid TOML file format at {pyproject_path}. Expected 'tool
- f"Invalid {self._cloud_config_path.name}. " + str(e)
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/9a5101d7395e2678.
Report an issue: GitHub.