{"record":{"id":"66fd9e95daa55933","repo":"reflex-dev/reflex","slug":"definition-python-name-captures-rest-props-fro","errorCode":null,"errorMessage":"`{definition.python_name}` captures rest props from extra keyword arguments. Do not pass `{rest_param.name}=` directly.","messagePattern":"`(.+?)` captures rest props from extra keyword arguments\\. Do not pass `(.+?)=` directly\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/components/memo.py","lineNumber":1542,"sourceCode":"        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)\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    ]","sourceCodeStart":1524,"sourceCodeEnd":1560,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/components/memo.py#L1524-L1560","documentation":"A memo that declares an `rx.RestProp` parameter automatically collects all extra keyword arguments as rest props. Passing that rest-prop parameter by its own name (e.g. `extra=...`) is rejected because it would be ambiguous with the collected rest props.","triggerScenarios":"Calling `@rx.memo def card(title: rx.Var[str], extra: rx.RestProp)` as `card(title=\"x\", extra={\"a\": 1})` — passing the parameter named `extra` directly by keyword raises the error.","commonSituations":"Naming a RestProp parameter something natural like `props` or `extra` and then instinctively passing `props=...` at the call site; treating the rest prop like an ordinary declared prop; IDE autocompletion inserting the parameter name.","solutions":["Pass the extra props as individual keyword arguments and let the RestProp collect them: `card(title=\"x\", a=1)`.","Rename the rest parameter to something you won't accidentally pass, by convention something like `rest_props: rx.RestProp`."],"exampleFix":"# before\n@rx.memo\ndef card(title: rx.Var[str], extra: rx.RestProp): ...\n\ncard(title=\"x\", extra={\"a\": 1})\n\n# after\ncard(title=\"x\", a=1)","handlingStrategy":"validation","validationCode":"def without_rest_key(props: dict, rest_name: str) -> dict:\n    return {k: v for k, v in props.items() if k != rest_name}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Name rest params distinctly (e.g. rest_props) to avoid passing them by accident.","Spread extra props individually as keyword arguments, never bundled under the rest parameter's name.","Filter prop dicts before **splats."],"tags":["reflex","memo","restprop","kwargs","typeerror"],"backgroundTag":"reserved-argument-name","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}