{"record":{"id":"d0b56a25f8fdb385","repo":"reflex-dev/reflex","slug":"definition-python-name-only-accepts-keyword-pr","errorCode":null,"errorMessage":"`{definition.python_name}` only accepts keyword props.","messagePattern":"`(.+?)` only accepts keyword props\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/components/memo.py","lineNumber":1553,"sourceCode":"        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    ]\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","sourceCodeStart":1535,"sourceCodeEnd":1571,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/components/memo.py#L1535-L1571","documentation":"A memoized component's declared props are keyword-only at the call site. If you pass positional arguments to a memo that has no children parameter, Reflex raises this TypeError because there is no positional slot for the values.","triggerScenarios":"Calling `badge(\"hello\")` where `@rx.memo def badge(label: rx.Var[str])` has no children param — the positional string has nowhere to bind. Any positional args on a children-less memo trigger it.","commonSituations":"Calling a prop-only memo like a plain function; passing a string first argument by habit (common when migrating from functions that took a label positionally); forgetting that only children, not props, may be positional.","solutions":["Pass all props by keyword: `badge(label=\"hello\")`.","If you intended the value to be children, add a children parameter to the memo signature (or rely on the children convention) and keep the positional argument."],"exampleFix":"# before\nbadge(\"hello\")\n\n# after\nbadge(label=\"hello\")","handlingStrategy":"type-guard","validationCode":"def call_memo(memo_fn, args: tuple, kwargs: dict):\n    if args and \"children\" not in memo_fn.__annotations__:\n        kwargs = dict(kwargs)\n        # convert positional props to keyword if you know the first param name\n    return memo_fn(*args, **kwargs)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call prop-only memos with keyword arguments: memo(label=\"x\").","Only positional arguments you pass to a memo should be children components.","Configure your linter/IDE to flag calls with unexpected positional args."],"tags":["reflex","memo","positional-args","keyword-props","typeerror"],"backgroundTag":"keyword-argument-required","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}