{"record":{"id":"0980f892b0743d3d","repo":"reflex-dev/reflex","slug":"event-chain-kwargs-event-chain-kwargs-r-are-igno","errorCode":null,"errorMessage":"event_chain_kwargs {event_chain_kwargs!r} are ignored for EventChainVar values.","messagePattern":"event_chain_kwargs (.+?) are ignored for EventChainVar values\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"packages/reflex-base/src/reflex_base/event/__init__.py","lineNumber":894,"sourceCode":"            value: The value to create the event chain from.\n            args_spec: The args_spec of the event trigger being bound.\n            key: The key of the event trigger being bound.\n            **event_chain_kwargs: Additional kwargs to pass to the EventChain constructor.\n\n        Returns:\n            The event chain.\n\n        Raises:\n            ValueError: If the value is not a valid event chain.\n        \"\"\"\n        # If it's an event chain var, return it.\n        if isinstance(value, Var):\n            # Only pass through literal/prebuilt chains. Other EventChainVar values may be\n            # FunctionVars cast with `.to(EventChain)` and still need wrapping so\n            # event_chain_kwargs can compose onto the resulting chain.\n            if isinstance(value, LiteralEventChainVar):\n                if event_chain_kwargs:\n                    warnings.warn(\n                        f\"event_chain_kwargs {event_chain_kwargs!r} are ignored for \"\n                        \"EventChainVar values.\",\n                        stacklevel=2,\n                    )\n                return value\n            if isinstance(value, (EventVar, FunctionVar)):\n                value = [value]\n            elif safe_issubclass(value._var_type, (EventChain, EventSpec)):\n                return cls.create(\n                    value=value.guess_type(),\n                    args_spec=args_spec,\n                    key=key,\n                    **event_chain_kwargs,\n                )\n            else:\n                msg = f\"Invalid event chain: {value!s} of type {value._var_type}\"\n                raise ValueError(msg)\n        elif isinstance(value, EventChain):","sourceCodeStart":876,"sourceCodeEnd":912,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/event/__init__.py#L876-L912","documentation":"Reflex's event spec factory (EventSpec.create) emits this Python warning when you pass event_chain_kwargs (e.g. event_loader, or chain-level args like stop_propagation/prevent_default on the chain) together with an already-built EventChainVar. For literal prebuilt chains there is nowhere to attach those kwargs, so they are silently ignored and you are warned.","triggerScenarios":"Calling rx.event.run_script(...)/event helpers or wiring an EventChainVar (e.g. a value already created with rx.action(...) / a LiteralEventChainVar) into an event trigger while also passing event_chain_kwargs such as {'event_loader': ...} or stopPropagation-style chain options, e.g. rx.button('Go', on_click=my_chain_var, ...custom kwargs...) via EventSpec.create / add_args / _as_event_spec.","commonSituations":"Migrating from passing a lambda/state action (which builds the chain lazily and accepts kwargs) to passing a prebuilt Var chain; sharing one prebuilt EventChainVar across components but trying to give each usage different chain kwargs; using .to(EventChain) casts.","solutions":["Move the kwargs into the chain construction site — build the chain with the desired options (e.g. rx.chain(..., stop_propagation=True) or pass event_loader where the EventChainVar is created) instead of at the trigger.","If the kwargs are redundant for this usage, delete them; the warning confirms they have no effect.","If you need per-trigger behavior, pass a lambda or action reference rather than a prebuilt EventChainVar, so kwargs compose onto a fresh chain."],"exampleFix":"# before\nchain = rx.action(rx.console_log('hi'))\nrx.button('Go', on_click=chain, stop_propagation=True)  # warns: ignored\n\n# after\nchain = rx.action(rx.console_log('hi'), stop_propagation=True)\nrx.button('Go', on_click=chain)","handlingStrategy":"validation","validationCode":"from reflex.vars import Var\n\ndef is_prebuilt_chain(v) -> bool:\n    return isinstance(v, Var) and getattr(v, '_var_type', None).__name__ in ('EventChain',)\n\n# only pass event_chain_kwargs when NOT passing a prebuilt EventChainVar\nkwargs = {} if is_prebuilt_chain(on_click) else {'stop_propagation': True}","typeGuard":"from reflex.event import EventChain\n\ndef is_literal_event_chain_var(v) -> bool:\n    return f'{type(v).__module__}.{type(v).__name__}' == 'reflex.event.LiteralEventChainVar'","tryCatchPattern":null,"preventionTips":["Apply chain-level options (stop_propagation, prevent_default, event_loader) where the chain is created, not at the trigger site.","Pass lambdas/state actions to on_click when you need per-trigger kwargs.","Treat this warning as a signal that your kwargs are no-ops — remove them instead of silencing it."],"tags":["events","event-chain","kwargs-ignored","warning","python"],"backgroundTag":"ignored-kwargs-warning","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}