reflex-dev/reflex · error · TypeError
The _var_is_local argument is not supported for Var.
Error message
The _var_is_local argument is not supported for Var.
What it means
Var._replace rejects the legacy keyword _var_is_local. Modern Var tracks locality inside VarData, so the old boolean flag is no longer accepted; passing it raises TypeError. The same guard covers _var_is_string and _var_full_name_needs_state_prefix.
Source
Thrown at packages/reflex-base/src/reflex_base/vars/base.py:787
merge_var_data: VarData | None = None,
**kwargs: Any,
) -> Self | Var:
"""Make a copy of this Var with updated fields.
Args:
_var_type: The new type of the Var.
merge_var_data: VarData to merge into the existing VarData.
**kwargs: Var fields to update.
Returns:
A new Var with the updated fields overwriting the corresponding fields in this Var.
Raises:
TypeError: If _var_is_local, _var_is_string, or _var_full_name_needs_state_prefix is not None.
"""
if kwargs.get("_var_is_local", False) is not False:
msg = "The _var_is_local argument is not supported for Var."
raise TypeError(msg)
if kwargs.get("_var_is_string", False) is not False:
msg = "The _var_is_string argument is not supported for Var."
raise TypeError(msg)
if kwargs.get("_var_full_name_needs_state_prefix", False) is not False:
msg = "The _var_full_name_needs_state_prefix argument is not supported for Var."
raise TypeError(msg)
value_with_replaced = dataclasses.replace(
self,
_var_type=_var_type or self._var_type,
_var_data=VarData.merge(
kwargs.get("_var_data", self._var_data), merge_var_data
),
**kwargs,
)
if (js_expr := kwargs.get("_js_expr")) is not None:View on GitHub (pinned to 45b8ed5ab7)
Solutions
- Remove the _var_is_local kwarg and set locality via VarData (e.g. pass a VarData with the appropriate hooks) or use the replacement public API
- Update the calling code to the current _replace signature (only _var_type/_var_data and friends)
- Upgrade any third-party reflex packages pinned to old versions so they stop passing the flag
- Search the codebase for _var_is_local and migrate every occurrence
Example fix
# before v = v._replace(_var_is_local=True) # after from reflex.vars import VarData v = v._replace(_var_data=VarData(...)) # locality now lives in VarData
Defensive patterns
Strategy: type-guard
Validate before calling
kwargs.pop('_var_is_local', None) # legacy kwarg, no longer supported
v = v._replace(**kwargs) Type guard
def is_supported_replace_kwarg(name: str) -> bool:
return name not in {'_var_is_local', '_var_is_string', '_var_full_name_needs_state_prefix'} Prevention
- Avoid private Var APIs; rely on Var.create/VarData
- After reflex upgrades, grep the codebase for removed flags like _var_is_local
When it happens
Trigger: Calling var._replace(_var_is_local=True) or dataclasses.replace-style updates with that kwarg; code written against an older reflex API where these flags existed on Var; copy-pasted internal framework code after an upgrade.
Common situations: Upgrading reflex to a version where Var internals were refactored to VarData; long-lived projects or component libraries using _replace with legacy kwargs; tutorials predating the refactor.
Related errors
- The _var_is_string argument is not supported for Var.
- The _var_full_name_needs_state_prefix argument is not suppor
- Expected _js_expr to be a string, got value {self._js_expr!r
- Unsupported type {var_type} for guess_type.
- Var of type {self._var_type} does not support item access.
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/7d46f19dca9aca54.
Report an issue: GitHub.