cocoindex-io/cocoindex · error · ValueError
deps= requires logic_tracking to be enabled; with logic_trac
Error message
deps= requires logic_tracking to be enabled; with logic_tracking=None the function's logic is not tracked at all, so the deps value would be silently ignored.
What it means
@coco.fn allows disabling logic tracking entirely with logic_tracking=None, in which case a deps= value would have no effect. To prevent silent misconfiguration, passing deps while logic_tracking is None raises ValueError at decorator time.
Source
Thrown at python/cocoindex/_internal/function.py:709
_memo_key: PreparedMemoKeySpec | None
_processor_info: core.ComponentProcessorInfo
_logic_fp: core.Fingerprint | None
_logic_tracking: LogicTracking
_return_deserializer: DeserializeFn | None
_return_deserializer_lock: threading.Lock
def __init__(
self,
fn: Callable[P, R_co],
*,
memo: bool,
memo_key: MemoKeySpec = None,
version: int | None = None,
logic_tracking: LogicTracking = "full",
deps: Any = None,
):
if logic_tracking is None and deps is not None:
raise ValueError(
"deps= requires logic_tracking to be enabled; with "
"logic_tracking=None the function's logic is not tracked at "
"all, so the deps value would be silently ignored."
)
self._fn = fn
self._memo = memo
self._memo_key = _normalize_memo_key(fn, memo_key)
self._processor_info = core.ComponentProcessorInfo(fn.__qualname__)
self._logic_tracking = logic_tracking
self._return_deserializer = None
self._return_deserializer_lock = threading.Lock()
if logic_tracking is not None:
self._logic_fp = _compute_logic_fingerprint(fn, version=version, deps=deps)
core.register_logic_fingerprint(self._logic_fp)
else:
self._logic_fp = None
View on GitHub (pinned to e84aa99b32)
Solutions
- Enable logic tracking (use the default "full" or another non-None mode) if deps-based invalidation is needed
- Remove the deps argument if tracking is intentionally disabled
- Document the tradeoff in the decorator so the two options aren't combined
Example fix
# before @coco.fn(logic_tracking=None, deps=[db_version]) async def fetch(x): ... # after @coco.fn(deps=[db_version]) # default logic_tracking="full" async def fetch(x): ...
Defensive patterns
Strategy: validation
Validate before calling
assert not (logic_tracking is None and deps is not None), "deps requires logic_tracking"
Prevention
- Treat logic_tracking=None and deps as mutually exclusive
- Use the default logic_tracking="full" whenever deps-based invalidation is needed
- Review decorator options together when copy-pasting @coco.fn configs
When it happens
Trigger: @coco.fn(logic_tracking=None, deps=[...]) — declaring dependency-based invalidation on a function whose logic tracking is turned off.
Common situations: Copy-pasting decorator configs where someone disabled tracking for performance but kept the deps list; misreading logic_tracking=None as 'lighter tracking' when it means none.
Related errors
- memo_key transform for *args must return tuple, got {type(va
- memo_key transform for **kwargs must return dict, got {type(
- Unknown memo_key parameter(s) for {qualified_name(fn)}(): {'
- Unknown memo_key parameter(s) for {qualified_name(fn)}(): {u
- coco.use_state() cannot be called inside a memoized function
AI-assisted analysis of cocoindex-io/cocoindex@e84aa99b32 (2026-09-08).
Data as JSON: /api/errors/3e1ea0daf8fb8101.
Report an issue: GitHub.