reflex-dev/reflex · error · InvalidPropValueError

Invalid prop(s) {invalid_fields_str} for {component_name!r}.

Error message

Invalid prop(s) {invalid_fields_str} for {component_name!r}. Supported props are {supported_props_str}

What it means

A Props-based component was instantiated with keyword fields that are not declared on the class. Reflex validates the provided kwargs against the known field names and raises `InvalidPropValueError` listing the invalid and supported props.

Source

Thrown at packages/reflex-base/src/reflex_base/components/props.py:439

        Args:
            component_name: The custom name of the component.
            kwargs: Kwargs to initialize the props.

        Raises:
            InvalidPropValueError: If invalid props are passed on instantiation.
        """
        component_name = component_name or type(self).__name__

        # Validate fields BEFORE setting them
        known_fields = set(self.__class__.get_fields().keys())
        provided_fields = set(kwargs.keys())
        invalid_fields = provided_fields - known_fields

        if invalid_fields:
            invalid_fields_str = ", ".join(invalid_fields)
            supported_props_str = ", ".join(f'"{field}"' for field in known_fields)
            msg = f"Invalid prop(s) {invalid_fields_str} for {component_name!r}. Supported props are {supported_props_str}"
            raise InvalidPropValueError(msg)

        # Use parent class initialization after validation
        super().__init__(**kwargs)

View on GitHub (pinned to 45b8ed5ab7)

Solutions

  1. Fix the typo / remove the invalid prop
  2. Check the error's supported-props list and use the correct name
  3. If forwarding props, intersect the dict with each component's fields before passing

Example fix

# before
rx.el.input(placeholder="x", valuee="y")

# after
rx.el.input(placeholder="x", value="y")
Defensive patterns

Strategy: validation

Validate before calling

from dataclasses import fields

def valid_kwargs(cls, kwargs: dict) -> dict:
    known = {f.name for f in fields(cls)}
    bad = set(kwargs) - known
    if bad:
        raise KeyError(f"unknown props {bad}; known: {sorted(known)}")
    return kwargs

rx.el.input(**valid_kwargs(rx.el.Input, props))

Type guard

def has_prop(component_cls, name: str) -> bool:
    from dataclasses import fields
    return name in {f.name for f in fields(component_cls)}

Try / catch

from reflex.components.props import InvalidPropValueError

try:
    comp = rx.el.input(**props)
except InvalidPropValueError as e:
    known = {f.name for f in __import__("dataclasses").fields(rx.el.Input)}
    comp = rx.el.input(**{k: v for k, v in props.items() if k in known})

Prevention

When it happens

Trigger: `rx.SomePropsComponent(invalid_prop=1)` where `invalid_prop` is not a declared props field; often from typos or passing props belonging to a different component.

Common situations: Version upgrades where a prop was renamed/removed, IDE autocompleting props from another component, or forwarding a shared props dict to multiple components.

Related errors


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