reflex-dev/reflex · error · TypeError

`{definition.python_name}` does not accept prop `{unknown[0]

Error message

`{definition.python_name}` does not accept prop `{unknown[0]}`. Only declared props may be passed when no `rx.RestProp` is present.

What it means

An undeclared keyword prop was passed to a memo component that has no `rx.RestProp`. The one exception is `key` (and other `_FORWARDABLE_BASE_PROPS`), which only warns — every other unknown prop raises. The message points at `rx.RestProp` as the escape hatch.

Source

Thrown at packages/reflex-base/src/reflex_base/components/memo.py:1762

            elif param.default is not inspect.Parameter.empty:
                explicit_values[param.name] = param.default
            else:
                msg = f"`{definition.python_name}` is missing required prop `{param.name}`."
                raise TypeError(msg)

        # Reject unknown props unless a rest prop is declared. ``key`` is the
        # one exception (see ``_FORWARDABLE_BASE_PROPS``); every other undeclared
        # prop raises with a message that points at ``rx.RestProp``.
        if remaining_props and rest_param is None:
            unknown = [
                name for name in remaining_props if name not in _FORWARDABLE_BASE_PROPS
            ]
            if unknown:
                msg = (
                    f"`{definition.python_name}` does not accept prop `{unknown[0]}`. "
                    "Only declared props may be passed when no `rx.RestProp` is present."
                )
                raise TypeError(msg)
            warned_key = frozenset(remaining_props)
            if warned_key not in self._warned_base_props:
                self._warned_base_props.add(warned_key)
                _warn_legacy_base_props(definition.python_name, list(remaining_props))

        # Reading ``component`` materializes the deferred body, so ``type(...)``
        # reflects the real wrapped class rather than the placeholder.
        if definition._runtime_inferred_params and not definition._component.is_ready:
            runtime_values = {
                name: explicit_values[name]
                for name in definition._runtime_inferred_params
                if name in explicit_values
            }
            component = definition._component.get(
                lambda: _evaluate_component_body(
                    definition.fn,
                    definition.params,
                    definition._rest_target_fields,

View on GitHub (pinned to 45b8ed5ab7)

Solutions

  1. Remove the unknown prop or map it to a declared one
  2. Declare `**rest: rx.RestProp` in the memo signature to accept and forward extra props
  3. For `key`, note it is allowed and only triggers a legacy-props warning once

Example fix

// before
@rx.memo
def card(title: str) -> rx.Component: ...
card(title="x", data_testid="t")

// after
@rx.memo
def card(title: str, **rest: rx.RestProp) -> rx.Component: ...
card(title="x", data_testid="t")
Defensive patterns

Strategy: validation

Validate before calling

import inspect

def declared_props(fn) -> set[str]:
    return set(inspect.signature(fn).parameters)

props = {k: v for k, v in incoming.items() if k in declared_props(card)}
card(**props)

Prevention

When it happens

Trigger: `card(title="x", aria-label="y")` where `card` only declares `title`; passing `className`, event handlers, or data attributes to a memo without a rest prop.

Common situations: Porting class-based components that accepted arbitrary HTML props; forwarding parent props; stale prop names after renames.

Related errors


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