reflex-dev/reflex · error · TypeError
The _var_is_string argument is not supported for Var.
Error message
The _var_is_string argument is not supported for Var.
What it means
Var._replace rejects the legacy keyword _var_is_string. String formatting state now lives in VarData (formatting/transform hooks), so passing the old boolean raises TypeError. Companion guards reject _var_is_local and _var_full_name_needs_state_prefix.
Source
Thrown at packages/reflex-base/src/reflex_base/vars/base.py:791
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:
object.__setattr__(value_with_replaced, "_js_expr", js_expr)
return value_with_replaced
View on GitHub (pinned to 45b8ed5ab7)
Solutions
- Drop the kwarg and express string-ness via the public API, e.g. Var.create(value, string=False) at creation time or VarData formatting hooks
- Update to the current _replace signature
- Upgrade pinned third-party reflex packages
- Grep for _var_is_string across the project and migrate all uses
Example fix
# before v = v._replace(_var_is_string=True) # after v = Var.create(v, string=True) # set string-ness at creation
Defensive patterns
Strategy: type-guard
Validate before calling
kwargs.pop('_var_is_string', None)
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
- Set string-ness at creation via Var.create(value, string=...)
- Pin or update third-party reflex libs together with reflex itself
When it happens
Trigger: Calling var._replace(_var_is_string=True); code or libraries written for an older reflex Var that accepted these flags; copy-pasted internal Reflex source after upgrading.
Common situations: Reflex version upgrades where Var was refactored (flags moved to VarData); stale component libraries; migration of large codebases using private Var APIs.
Related errors
- The _var_is_local 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/200785be2fef9d08.
Report an issue: GitHub.