{"record":{"id":"b7caf0275c6dc41e","repo":"reflex-dev/reflex","slug":"children-in-fn-name-cannot-be-rx-restprop","errorCode":null,"errorMessage":"`children` in `{fn_name}` cannot be `rx.RestProp`.","messagePattern":"`children` in `(.+?)` cannot be `rx\\.RestProp`\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/components/memo.py","lineNumber":944,"sourceCode":"\n\ndef _validate_children(\n    parameter: inspect.Parameter, fn_name: str, for_component: bool\n) -> None:\n    if parameter.name != \"children\":\n        msg = (\n            f\"`rx.Var[rx.Component]` parameters in `{fn_name}` must be named \"\n            \"`children`.\"\n        )\n        raise TypeError(msg)\n\n\ndef _validate_rest(\n    parameter: inspect.Parameter, fn_name: str, for_component: bool\n) -> None:\n    if parameter.name == \"children\":\n        msg = f\"`children` in `{fn_name}` cannot be `rx.RestProp`.\"\n        raise TypeError(msg)\n\n\ndef _validate_event_trigger(\n    parameter: inspect.Parameter, fn_name: str, for_component: bool\n) -> None:\n    if not for_component:\n        msg = (\n            f\"`rx.EventHandler` parameters are only supported on component-\"\n            f\"returning memos. Got `{parameter.name}` in `{fn_name}`.\"\n        )\n        raise TypeError(msg)\n    if parameter.name == \"children\":\n        msg = (\n            f\"`children` in `{fn_name}` cannot be an `rx.EventHandler`; \"\n            \"use `rx.Var[rx.Component]`.\"\n        )\n        raise TypeError(msg)\n    if parameter.default is not inspect.Parameter.empty:","sourceCodeStart":926,"sourceCodeEnd":962,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/components/memo.py#L926-L962","documentation":"An `@rx.memo` function declared a parameter named `children` annotated as `rx.RestProp` (the `...` rest-props placeholder). The `children` slot is special — it maps to React's children — and cannot double as the catch-all rest-props bag. Reflex raises this TypeError during parameter validation at decoration time.","triggerScenarios":"Writing `def my_memo(children: rx.RestProp)` (or `children: ...` where RestProp is the annotation) so `_validate_rest` sees `parameter.name == \"children\"` and raises.","commonSituations":"Trying to forward all props including children with a single rest parameter and naming it `children`; auto-generating memo signatures from `**kwargs` and accidentally colliding with the reserved name.","solutions":["Rename the RestProp parameter to something else (e.g. `rest: rx.RestProp` or use bare `...` on an unnamed slot) so `children` stays free","Declare `children: rx.Var[rx.Component]` separately if you need the children slot, and use a differently-named `rx.RestProp` for extra props"],"exampleFix":"// before\n@rx.memo\ndef panel(children: rx.RestProp) -> rx.Component:\n    ...\n\n// after\n@rx.memo\ndef panel(children: rx.Var[rx.Component], rest: rx.RestProp) -> rx.Component:\n    ...","handlingStrategy":"type-guard","validationCode":"import inspect, reflex as rx\n\ndef check_no_rest_children(fn) -> None:\n    for p in inspect.signature(fn).parameters.values():\n        if p.name == \"children\" and p.annotation is rx.RestProp:\n            raise TypeError(\"children cannot be rx.RestProp; rename the rest param\")","typeGuard":"import inspect, reflex as rx\n\ndef is_valid_rest_usage(fn) -> bool:\n    return all(\n        not (p.name == \"children\" and p.annotation is rx.RestProp)\n        for p in inspect.signature(fn).parameters.values()\n    )","tryCatchPattern":null,"preventionTips":["Never name a RestProp parameter `children`","Use conventional names like `rest` or `props` for rest-props placeholders","Keep `children: rx.Var[rx.Component]` as a separate explicit parameter when both are needed"],"tags":["reflex","rx-memo","typeerror","children","rest-props"],"backgroundTag":"decorator-validation-failed","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}