{"record":{"id":"bf17e2afe379f0e8","repo":"reflex-dev/reflex","slug":"definition-python-name-only-accepts-positional","errorCode":null,"errorMessage":"`{definition.python_name}` only accepts positional children that are `rx.Component` or `rx.Var[rx.Component]`.","messagePattern":"`(.+?)` only accepts positional children that are `rx\\.Component` or `rx\\.Var\\[rx\\.Component\\]`\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/components/memo.py","lineNumber":1570,"sourceCode":"        )\n        raise TypeError(msg)\n\n    # Bind declared props before collecting any rest props.\n    explicit_params = [\n        param\n        for param in definition.params\n        if param.kind not in (MemoParamKind.REST, MemoParamKind.CHILDREN)\n    ]\n    explicit_values = {}\n    remaining_props = kwargs.copy()\n    for param in explicit_params:\n        if param.name in remaining_props:\n            explicit_values[param.name] = remaining_props.pop(param.name)\n        elif param.default is not inspect.Parameter.empty:\n            explicit_values[param.name] = param.default\n        else:\n            msg = f\"`{definition.python_name}` is missing required prop `{param.name}`.\"\n            raise TypeError(msg)\n\n    # Reject unknown props unless a rest prop is declared.\n    if remaining_props and rest_param is None:\n        unexpected_prop = next(iter(remaining_props))\n        msg = (\n            f\"`{definition.python_name}` does not accept prop `{unexpected_prop}`. \"\n            \"Only declared props may be passed when no `rx.RestProp` is present.\"\n        )\n        raise TypeError(msg)\n\n    # Return ordered explicit args when no packed props object is needed.\n    if children_param is None and rest_param is None:\n        return tuple(explicit_values[param.name] for param in explicit_params)\n\n    # Build the props object passed to the imported FunctionVar.\n    children_value: Any | None = None\n    if children_param is not None:\n        from reflex_components_core.base.fragment import Fragment","sourceCodeStart":1552,"sourceCodeEnd":1588,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/components/memo.py#L1552-L1588","documentation":"Positional arguments to a memo are treated as children, and each child must be an `rx.Component` or `rx.Var[rx.Component]`. Passing raw strings, numbers, lists, or other non-component values positionally raises this TypeError.","triggerScenarios":"Calling `card(\"some title\", title=\"x\")` — the positional string is not an `rx.Component`. Lists of components, plain dicts, or Python primitives passed positionally also trigger it.","commonSituations":"Assuming memo children work like `rx.box(\"text\")` (which auto-wraps strings); passing a `list` of children instead of unpacking them; passing state values or computed Python objects positionally instead of as annotated `rx.Var` props.","solutions":["Wrap raw text in a component: `card(rx.text(\"some title\"), title=\"x\")`.","Unpack lists of children: `card(*children)` where each element is a component.","Pass data-like values as keyword props with `rx.Var` annotations rather than as positional children."],"exampleFix":"# before\ncard(\"some title\", title=\"x\")\n\n# after\ncard(rx.text(\"some title\"), title=\"x\")","handlingStrategy":"type-guard","validationCode":"import reflex as rx\n\ndef valid_children(args) -> bool:\n    return all(isinstance(c, (rx.Component, rx.Var)) for c in args)","typeGuard":"import reflex as rx\n\ndef is_component_child(value) -> bool:\n    return isinstance(value, (rx.Component, rx.Var))","tryCatchPattern":null,"preventionTips":["Wrap strings/numbers in rx.text/rx.heading before passing positionally.","Unpack component lists with * instead of passing the list itself.","Pass data values as keyword rx.Var props, not as positional children."],"tags":["reflex","memo","children","typeerror","component-types"],"backgroundTag":"invalid-children-type","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}