{"record":{"id":"3e1ea0daf8fb8101","repo":"cocoindex-io/cocoindex","slug":"deps-requires-logic-tracking-to-be-enabled-with","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/cocoindex/_internal/function.py","lineNumber":709,"sourceCode":"    _memo_key: PreparedMemoKeySpec | None\n    _processor_info: core.ComponentProcessorInfo\n    _logic_fp: core.Fingerprint | None\n    _logic_tracking: LogicTracking\n    _return_deserializer: DeserializeFn | None\n    _return_deserializer_lock: threading.Lock\n\n    def __init__(\n        self,\n        fn: Callable[P, R_co],\n        *,\n        memo: bool,\n        memo_key: MemoKeySpec = None,\n        version: int | None = None,\n        logic_tracking: LogicTracking = \"full\",\n        deps: Any = None,\n    ):\n        if logic_tracking is None and deps is not None:\n            raise ValueError(\n                \"deps= requires logic_tracking to be enabled; with \"\n                \"logic_tracking=None the function's logic is not tracked at \"\n                \"all, so the deps value would be silently ignored.\"\n            )\n        self._fn = fn\n        self._memo = memo\n        self._memo_key = _normalize_memo_key(fn, memo_key)\n        self._processor_info = core.ComponentProcessorInfo(fn.__qualname__)\n        self._logic_tracking = logic_tracking\n        self._return_deserializer = None\n        self._return_deserializer_lock = threading.Lock()\n\n        if logic_tracking is not None:\n            self._logic_fp = _compute_logic_fingerprint(fn, version=version, deps=deps)\n            core.register_logic_fingerprint(self._logic_fp)\n        else:\n            self._logic_fp = None\n","sourceCodeStart":691,"sourceCodeEnd":727,"githubUrl":"https://github.com/cocoindex-io/cocoindex/blob/e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b/python/cocoindex/_internal/function.py#L691-L727","documentation":"@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.","triggerScenarios":"@coco.fn(logic_tracking=None, deps=[...]) — declaring dependency-based invalidation on a function whose logic tracking is turned off.","commonSituations":"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.","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"],"exampleFix":"# before\n@coco.fn(logic_tracking=None, deps=[db_version])\nasync def fetch(x): ...\n\n# after\n@coco.fn(deps=[db_version])  # default logic_tracking=\"full\"\nasync def fetch(x): ...","handlingStrategy":"validation","validationCode":"assert not (logic_tracking is None and deps is not None), \"deps requires logic_tracking\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["memoization","decorator-config","mutually-exclusive-options"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"e84aa99b3292c5270a4b313b2a7137ad9ce8ab3b","analyzedAt":"2026-09-08T15:59:19.997Z","contentChangedAt":"2026-09-08T15:59:19.997Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}