reflex-dev/reflex · critical · ChildrenTypeError
ChildrenTypeError(component=cls.__name__, child=child)
Error message
ChildrenTypeError(component=cls.__name__, child=child)
What it means
After fetching state from redis, Reflex type-checks the result: the deserialized object must be an instance of the requested state class, otherwise StateMismatchError. This catches schema/full-name collisions where stored state maps to a different class.
Source
Thrown at packages/reflex-base/src/reflex_base/components/component.py:1291
def _get_components_in_props(self) -> Sequence[BaseComponent]:
"""Get the components in the props.
Returns:
The components in the props
"""
return self._get_component_prop_property
@classmethod
def _validate_children(cls, children: tuple | list):
from reflex_base.utils.exceptions import ChildrenTypeError
for child in children:
if isinstance(child, (tuple, list)):
cls._validate_children(child)
# Make sure the child is a valid type.
if isinstance(child, dict) or not isinstance(child, ComponentChildTypes):
raise ChildrenTypeError(component=cls.__name__, child=child)
@classmethod
def create(cls: type[T], *children, **props) -> T:
"""Create the component.
Args:
*children: The children of the component.
**props: The props of the component.
Returns:
The component.
"""
# Import here to avoid circular imports.
from reflex_components_core.base.bare import Bare
from reflex_components_core.base.fragment import Fragment
# Filter out None props
props = {key: value for key, value in props.items() if value is not None}View on GitHub (pinned to 45b8ed5ab7)
Solutions
- Flush the stale redis keys / use a distinct redis_db or key prefix per app
- Ensure state class names and hierarchy are unique and stable across deployments
- Use a proper redis_url per environment so apps don't share tokens
Defensive patterns
Strategy: try-catch
Try / catch
try:
st = await self.get_state(OtherState)
except StateMismatchError:
# stale/corrupt redis entry for this token
await invalidate_token() Prevention
- Namespace redis per app (unique redis_db or key prefix)
- Avoid redefining state class names across deployments
When it happens
Trigger: Redis returns an object whose class differs from state_cls — e.g. two state classes with the same full name across app versions, or corrupted/mismatched pickle data under a token.
Common situations: Deploying a renamed/restructured state while old tokens still exist in redis; multiple apps sharing one redis DB with colliding state names.
Related errors
- Undefined library for NoSSRComponent
- Do not override _add_style directly. Use add_style instead.
- The component `{comp_name}` only allows the components: {val
- Component must have a library to bundle.
- {self._prefixes[0]}REDIS_URL is required when using the redi
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/3c8b29be71942de1.
Report an issue: GitHub.