{"record":{"id":"7f0c757519e6325a","repo":"reflex-dev/reflex","slug":"definition-python-name-only-accepts-children-p","errorCode":null,"errorMessage":"`{definition.python_name}` only accepts children positionally.","messagePattern":"`(.+?)` only accepts children positionally\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/components/memo.py","lineNumber":1535,"sourceCode":"\n    Args:\n        definition: The function memo definition.\n        *args: Positional arguments.\n        **kwargs: Keyword arguments.\n\n    Returns:\n        The ordered arguments for the imported FunctionVar.\n\n    Raises:\n        TypeError: If the provided arguments are invalid.\n    \"\"\"\n    children_param = _get_children_param(definition.params)\n    rest_param = _get_rest_param(definition.params)\n\n    # Validate positional children usage and reserved keywords.\n    if \"children\" in kwargs:\n        msg = f\"`{definition.python_name}` only accepts children positionally.\"\n        raise TypeError(msg)\n\n    if rest_param is not None and rest_param.name in kwargs:\n        msg = (\n            f\"`{definition.python_name}` captures rest props from extra keyword \"\n            f\"arguments. Do not pass `{rest_param.name}=` directly.\"\n        )\n        raise TypeError(msg)\n\n    if args and children_param is None:\n        msg = f\"`{definition.python_name}` only accepts keyword props.\"\n        raise TypeError(msg)\n\n    if any(not _is_component_child(child) for child in args):\n        msg = (\n            f\"`{definition.python_name}` only accepts positional children that are \"\n            \"`rx.Component` or `rx.Var[rx.Component]`.\"\n        )\n        raise TypeError(msg)","sourceCodeStart":1517,"sourceCodeEnd":1553,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/components/memo.py#L1517-L1553","documentation":"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\"))`.","triggerScenarios":"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`).","commonSituations":"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.","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."],"exampleFix":"# before\ncard(title=\"x\", children=rx.text(\"body\"))\n\n# after\ncard(rx.text(\"body\"), title=\"x\")","handlingStrategy":"validation","validationCode":"def safe_call(memo_fn, *children, **props):\n    props.pop(\"children\", None)  # reserved: children go positionally\n    return memo_fn(*children, **props)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["reflex","memo","children","reserved-keyword","typeerror"],"backgroundTag":"reserved-argument-name","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}