reflex-dev/reflex · error · ConfigError

frontend_compression_formats contains unsupported format {fo

Error message

frontend_compression_formats contains unsupported format {format_name!r}. Expected one of: {', '.join(sorted(supported))}.

What it means

Raised during Config post-init when the frontend_compression_formats setting contains a format name that is not in the supported set (e.g. 'gzip', 'brotli'). The config normalizes and deduplicates the list, and any unknown entry aborts app startup with a ConfigError. This exists to fail fast on typos before the frontend build pipeline runs.

Source

Thrown at packages/reflex-base/src/reflex_base/config.py:579

    def _normalize_frontend_compression_formats(self):
        """Normalize and validate configured frontend compression formats.

        Raises:
            ConfigError: If an unsupported format name is configured.
        """
        supported = {"brotli", "gzip", "zstd"}
        normalized: list[str] = []
        seen: set[str] = set()
        for format_name in self.frontend_compression_formats:
            name = format_name.strip().lower()
            if not name or name in seen:
                continue
            if name not in supported:
                msg = (
                    f"frontend_compression_formats contains unsupported format "
                    f"{format_name!r}. Expected one of: {', '.join(sorted(supported))}."
                )
                raise ConfigError(msg)
            normalized.append(name)
            seen.add(name)
        self.frontend_compression_formats = normalized

    def _normalize_paths(self):
        """Ensure frontend and backend paths start with a slash if provided."""
        if self.frontend_path and not self.frontend_path.startswith("/"):
            self.frontend_path = f"/{self.frontend_path}"

        if self.backend_path and not self.backend_path.startswith("/"):
            self.backend_path = f"/{self.backend_path}"

    def _add_builtin_plugins(self):
        """Add the builtin plugins to the config."""
        for plugin in _PLUGINS_ENABLED_BY_DEFAULT:
            plugin_name = plugin.__module__ + "." + plugin.__qualname__
            if plugin not in self.disable_plugins:
                if not any(isinstance(p, plugin) for p in self.plugins):

View on GitHub (pinned to 45b8ed5ab7)

Solutions

  1. Check the error message: it lists the exact supported formats (sorted); use one of those names
  2. Fix typos, e.g. 'gz' -> 'gzip', 'br' -> 'brotli'
  3. Remove the unsupported entry if the default behavior is acceptable
  4. Verify the name against the Reflex version's supported set (docs or the module defining `supported`)

Example fix

# before
app = rx.App(
    config=rx.Config(frontend_compression_formats=["gz", "zstd"])
)
# after
app = rx.App(
    config=rx.Config(frontend_compression_formats=["gzip", "brotli"])
)
Defensive patterns

Strategy: validation

Validate before calling

from reflex_base.config import get_supported_compression_formats  # or read the module constant
fmts = ["gzip", "brotli"]
assert set(fmts) <= set(get_supported_compression_formats()), f"unsupported: {set(fmts) - set(get_supported_compression_formats())}"

Type guard

null

Try / catch

try:
    rx.Config(frontend_compression_formats=fmts)
except ConfigError as e:
    logger.error("bad compression formats: %s", e)
    fmts = ["gzip"]  # safe default

Prevention

When it happens

Trigger: Setting rx.Config(frontend_compression_formats=[...]) or the corresponding environment variable with a misspelled or unsupported format string, e.g. ['gz'] or ['zstd'] when only 'gzip'/'brotli' are supported. Raised from Config __post_init__ via _normalize_frontend_compression_formats.

Common situations: Typos like 'gz' instead of 'gzip', copying a format name from an older/newer Reflex version where the supported set differs, or assuming a format like 'zstd' is supported because a web server supports it.

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/b50c0eb218360d29. Report an issue: GitHub.