reflex-dev/reflex · critical · ValueError

Named props cannot be used with custom thresholds

Error message

Named props cannot be used with custom thresholds

What it means

Raised by AppHarness's frontend/driver helper when the harness has no frontend URL to connect a Selenium browser to. Reflex's testing harness starts both a backend (uvicorn) and a frontend server; if _wait_frontend never completed or start() was not called before requesting a driver, frontend_url stays None and this RuntimeError is thrown. It almost always indicates the harness fixture was used incorrectly or the frontend process died during startup.

Source

Thrown at packages/reflex-base/src/reflex_base/breakpoints.py:77

            initial: Styling when in the initial width
            xs: Styling when in the extra-small width
            sm: Styling when in the small width
            md: Styling when in the medium width
            lg: Styling when in the large width
            xl: Styling when in the extra-large width

        Returns:
            The responsive mapping.

        Raises:
            ValueError: If both custom and any other named parameters are provided.
        """
        thresholds = [initial, xs, sm, md, lg, xl]

        if custom is not None:
            if any(threshold is not None for threshold in thresholds):
                msg = "Named props cannot be used with custom thresholds"
                raise ValueError(msg)

            return Breakpoints(custom)
        return Breakpoints({
            k: v
            for k, v in zip(["initial", *breakpoint_names], thresholds, strict=True)
            if v is not None
        })


breakpoints = Breakpoints.create

T = TypeVar("T")

Responsive = T | Breakpoints[str, T]

View on GitHub (pinned to 45b8ed5ab7)

Solutions

  1. Ensure all driver/browser calls happen inside the `with AppHarness.create(...) as harness:` block, after the fixture yields
  2. Check the harness logs (harness._frontend_log / captured output) for why the frontend process exited early
  3. Verify `uv sync` ran and .web/node_modules exists so the frontend can actually start
  4. Set APP_HARNESS_DRIVER and related env vars correctly and confirm selenium is installed in the test environment

Example fix

// before
def test_thing():
    harness = my_harness()  # used after context exited
    driver = harness.driver()
// after
@pytest.fixture
def my_harness(tmp_path_factory):
    with AppHarness.create(root=tmp_path_factory.mktemp("app"), app_source=MyApp) as harness:
        yield harness

def test_thing(my_harness):
    driver = my_harness.driver()
Defensive patterns

Strategy: validation

Validate before calling

assert harness.frontend_url is not None, "frontend not started; check harness logs"

Prevention

When it happens

Trigger: Calling harness.driver()/get_driver() before AppHarness.create(...) has started the servers, or after the frontend failed to bind (crashed on startup, port issues). Also triggered when the 'with AppHarness.create(...)' context manager body runs code that assumes the frontend is up while _wait_frontend timed out.

Common situations: Using the AppHarness fixture outside its context manager; CI environments where the frontend build fails (missing node_modules, wrong Node version); custom fixtures that call start() partially; races where the frontend process exits immediately.

Related errors


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