reflex-dev/reflex · error · TypeError
` ` only accepts children positionally.
Error message
`{definition.python_name}` only accepts children positionally. What it means
When calling a memoized component, `children` is a reserved positional-only slot; passing `children=` as a keyword argument is rejected. Children must be given positionally, e.g. `my_memo(rx.text("hi"))`, not `my_memo(children=rx.text("hi"))`.
Solutions
- Move children to positional arguments: `card(rx.text("body"), title="x")`.
- If the memo should accept children as a normal prop, rename its parameter to something other than the reserved `children` handling, or restructure so children flow positionally.
Example fix
# before
card(title="x", children=rx.text("body"))
# after
card(rx.text("body"), title="x") Defensive patterns
Strategy: validation
Validate before calling
def safe_call(memo_fn, *children, **props):
props.pop("children", None) # reserved: children go positionally
return memo_fn(*children, **props) Prevention
- Never pass children= as a keyword; always give children positionally as the first arguments.
- Treat 'children' as reserved like in React, but positional in Reflex.
- Watch out for **props splatting dicts that contain a 'children' key.
When it happens
Trigger: Calling a memo component with a `children` keyword: `card(title="x", children=rx.text("body"))`. Raised in `_bind_function_runtime_args` at call time (including via `functools.partial`-style `partial`).
Common situations: Habits carried over from React/Next.js (`children` prop) or other component libs where children is a named prop; IDE autocompleting `children=`; copy-pasting JSX-style props into Reflex calls.
Related errors
- ` ` only accepts positional children that are…
- All parameters of ` ` must be annotated as `rx.Var[...]` or…
- `children` in ` ` cannot be an `rx.EventHandler`; use…
- `children` in ` ` cannot be `rx.RestProp`.
- `children` in ` ` must be annotated as…
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/7f0c757519e6325a.
Report an issue: GitHub.
Appendix: source
Thrown at packages/reflex-base/src/reflex_base/components/memo.py:1535
Args:
definition: The function memo definition.
*args: Positional arguments.
**kwargs: Keyword arguments.
Returns:
The ordered arguments for the imported FunctionVar.
Raises:
TypeError: If the provided arguments are invalid.
"""
children_param = _get_children_param(definition.params)
rest_param = _get_rest_param(definition.params)
# Validate positional children usage and reserved keywords.
if "children" in kwargs:
msg = f"`{definition.python_name}` only accepts children positionally."
raise TypeError(msg)
if rest_param is not None and rest_param.name in kwargs:
msg = (
f"`{definition.python_name}` captures rest props from extra keyword "
f"arguments. Do not pass `{rest_param.name}=` directly."
)
raise TypeError(msg)
if args and children_param is None:
msg = f"`{definition.python_name}` only accepts keyword props."
raise TypeError(msg)
if any(not _is_component_child(child) for child in args):
msg = (
f"`{definition.python_name}` only accepts positional children that are "
"`rx.Component` or `rx.Var[rx.Component]`."
)
raise TypeError(msg)View on GitHub (pinned to 45b8ed5ab7)