reflex-dev/reflex · error · VarDependencyError
Cannot track dependencies without caching.
Error message
Cannot track dependencies without caching.
What it means
Raised when dependencies (deps=[...] or auto_deps=False) are supplied for a computed var while cache=False. Dependency tracking only applies to cached computed vars, so reflex rejects the combination.
Source
Thrown at packages/reflex-base/src/reflex_base/vars/base.py:2984
interval: Interval at which the computed var should be updated.
backend: Whether the computed var is a backend var.
**kwargs: additional attributes to set on the instance
Returns:
A ComputedVar instance.
Raises:
ValueError: If caching is disabled and an update interval is set.
VarDependencyError: If user supplies dependencies without caching.
ComputedVarSignatureError: If the getter function has more than one argument.
"""
if cache is False and interval is not None:
msg = "Cannot set update interval without caching."
raise ValueError(msg)
if cache is False and (deps is not None or auto_deps is False):
msg = "Cannot track dependencies without caching."
raise VarDependencyError(msg)
if fget is not None:
sign = inspect.signature(fget)
if len(sign.parameters) != 1:
raise ComputedVarSignatureError(fget.__name__, signature=str(sign))
if inspect.iscoroutinefunction(fget):
computed_var_cls = AsyncComputedVar
else:
computed_var_cls = ComputedVar
return computed_var_cls(
fget,
initial_value=initial_value,
cache=cache,
deps=deps,
auto_deps=auto_deps,
interval=interval,
backend=backend,View on GitHub (pinned to 45b8ed5ab7)
Solutions
- Remove deps/auto_deps and let automatic dependency detection run with caching enabled (default), or
- Keep deps but set cache=True
Example fix
# before @rx.memo(cache=False, deps=[State.count]) def doubled(self) -> int: return self.count * 2 # after @rx.memo(deps=[State.count]) def doubled(self) -> int: return self.count * 2
Defensive patterns
Strategy: validation
Validate before calling
if cache is False and (deps is not None or auto_deps is False):
raise ValueError('deps/auto_deps require cache=True') Prevention
- Keep deps only on cached vars
- Rely on automatic dependency tracking with default caching
When it happens
Trigger: @rx.memo(cache=False, deps=[State.foo]) or passing auto_deps=False with cache=False to rx.computed.
Common situations: Migrating from manual deps to automatic dependency tracking and leaving cache=False behind; mixing legacy arg patterns in one decorator.
Related errors
- ComputedVar dependencies must be Var instances or var names
- ComputedVar dependencies must be Var instances with a state
- Cannot set update interval without caching.
- Do not override _add_style directly. Use add_style instead.
- UntypedComputedVarError(var_name=fget.__name__)
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/c89cc99ae127ba6e.
Report an issue: GitHub.