reflex-dev/reflex · error · ConfigInvalidFieldValueError

f"Invalid {self._cloud_config_path.name}. " + str(e)

Error message

f"Invalid {self._cloud_config_path.name}. " + str(e)

What it means

ConfigInvalidFieldValueError is raised in CloudConfig.__post_init__ when one of the config fields fails the _validate_dispatch validation. If the config was loaded from a file, the message is prefixed with the config filename so the user knows which file contains the bad value. It re-raises with the original traceback and suppresses the exception chain (from None) so only the wrapper error is shown.

Source

Thrown at packages/reflex-hosting-cli/src/reflex_cli/core/config.py:169

            ConfigInvalidFieldValueError: If any field value is invalid.

        # noqa: DAR401

        """
        evaluated_type = typing.get_type_hints(Config)
        for field in dataclasses.fields(self):
            if field.name.startswith("_"):
                continue
            field_type = evaluated_type.get(field.name)
            if field_type is None:
                raise ConfigInvalidFieldValueError(f"Invalid field: {field}")
            try:
                _validate_dispatch(
                    getattr(self, field.name), field_type, key=field.name
                )
            except ValueError as e:
                if self._cloud_config_path:
                    raise ConfigInvalidFieldValueError(
                        f"Invalid {self._cloud_config_path.name}. " + str(e)
                    ).with_traceback(e.__traceback__) from None

    @classmethod
    def _filter_dict(
        cls,
        data: dict[str, Any],
    ) -> dict[str, Any]:
        """Filters a dictionary to only include fields defined in the Config class.

        Args:
            data: The dictionary to filter.

        Returns:
            dict[str, Any]: A filtered dictionary containing only valid Config fields.

        """
        fields_keys = {field.name for field in dataclasses.fields(cls)}

View on GitHub (pinned to 45b8ed5ab7)

Solutions

  1. Check the field named in the message (str(e) suffix) and fix its value in the config file shown
  2. Compare each entry in your rxconfig.yaml / [tool.reflex-cloud] section against the field types documented in reflex_cli.core.config
  3. If unsure of allowed values, remove the offending key to fall back to its default
  4. Re-run the CLI command to confirm validation passes

Example fix

# before (rxconfig.yaml)
vmtype: large  # invalid value
regions: nyc

# after
vmtype: 2
regions:
  - nyc
Defensive patterns

Strategy: validation

Validate before calling

import tomllib, pathlib
p = pathlib.Path("pyproject.toml")
data = tomllib.loads(p.read_text())["tool"]["reflex-cloud"]
for k, v in data.items():
    assert isinstance(v, (str, int, float, bool, list)), f"field {k} has invalid type {type(v)}"

Type guard

def looks_like_valid_cloud_config(data: dict) -> bool:
    return isinstance(data, dict) and all(
        isinstance(v, (str, int, float, bool, list, dict)) for v in data.values()
    )

Prevention

When it happens

Trigger: Constructing or loading a CloudConfig where a field value violates its declared type/validator, e.g. a non-integer vmtype, an invalid regions entry, or a malformed project name in rxconfig.yaml or pyproject.toml [tool.reflex-cloud]. Any CLI command that loads config (deploy, login-protected commands via read_config) hits this.

Common situations: Hand-editing rxconfig.yaml or pyproject.toml and introducing a typo or wrong type (e.g. regions: "nyc" as a string instead of a list, vmtype: "large" when only specific IDs are allowed); upgrading reflex-cli where a field's expected type changed.

Understand the failure class

Background: Config validation failed: what "invalid value for {key}" and settings-rejection errors mean across 19 open-source libraries — this error's family across 19 libraries.

Related errors


AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28). Data as JSON: /api/errors/a0792bace85d5e2d. Report an issue: GitHub.