reflex-dev/reflex · error · ValueError
Cannot set update interval without caching.
Error message
Cannot set update interval without caching.
What it means
Raised when a ComputedVar is declared with cache=False but an update interval is supplied. Caching must be enabled for rx.memo/cache=True before interval-based refresh makes sense, so reflex rejects the combination at decoration time.
Source
Thrown at packages/reflex-base/src/reflex_base/vars/base.py:2980
initial_value: The initial value of the computed var.
cache: Whether to cache the computed value.
deps: Explicit var dependencies to track.
auto_deps: Whether var dependencies should be auto-determined.
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,View on GitHub (pinned to 45b8ed5ab7)
Solutions
- Remove the interval argument, or
- Set cache=True (the default) and keep the interval, e.g. @rx.memo(interval=5)
Example fix
# before @rx.memo(cache=False, interval=5) def total(self) -> int: ... # after @rx.memo(interval=5) def total(self) -> int: ...
Defensive patterns
Strategy: validation
Validate before calling
import inspect
sig = inspect.signature(rx.memo)
params = {k: v.default for k, v in sig.parameters.items()}
# in tests: assert not (kwargs.get('cache') is False and kwargs.get('interval') is not None) Prevention
- Never combine cache=False with interval or deps
- Run a lint/test asserting decorator kwargs are mutually compatible
When it happens
Trigger: @rx.memo(cache=False, interval=5) or rx.computed(var_name, cache=False, interval=...) — any computed var decorator/signature where cache is explicitly False and interval is not None.
Common situations: Developer disables caching to always recompute, then also tries to add interval throttling; or copies a cached-var example but flips cache to False.
Related errors
- Cannot track dependencies without caching.
- Do not override _add_style directly. Use add_style instead.
- No default value or factory provided.
- UntypedComputedVarError(var_name=fget.__name__)
- Unexpected keyword arguments: {tuple(kwargs)}
AI-assisted analysis of reflex-dev/reflex@45b8ed5ab7 (2026-08-28).
Data as JSON: /api/errors/7ebdff1c63980dc6.
Report an issue: GitHub.