{"record":{"id":"51c4a35eaba07740","repo":"langchain-ai/deepagents","slug":"tick-seconds-must-be-positive","errorCode":null,"errorMessage":"tick_seconds must be positive","messagePattern":"tick_seconds must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/talon/deepagents_talon/cron/scheduler.py","lineNumber":50,"sourceCode":"        run_job: Callback that invokes the agent for a claimed job.\n        deliver_result: Callback that delivers non-silent job output.\n        tick_seconds: Interval between due-job scans.\n        now: Clock override for deterministic tests.\n    \"\"\"\n\n    def __init__(\n        self,\n        *,\n        store: CronJobStore,\n        run_job: RunCronJob,\n        deliver_result: DeliverCronResult,\n        tick_seconds: float = DEFAULT_TICK_SECONDS,\n        now: NowFactory | None = None,\n    ) -> None:\n        \"\"\"Initialize the scheduler without starting the ticker.\"\"\"\n        if tick_seconds <= 0:\n            msg = \"tick_seconds must be positive\"\n            raise ValueError(msg)\n        self.store = store\n        self.run_job = run_job\n        self.deliver_result = deliver_result\n        self.tick_seconds = tick_seconds\n        self.now = now or (lambda: datetime.now(UTC))\n        self._task: asyncio.Task[None] | None = None\n        self._stopped = asyncio.Event()\n\n    async def start(self) -> None:\n        \"\"\"Start the scheduler ticker.\"\"\"\n        if self._task is not None and not self._task.done():\n            return\n        self._stopped.clear()\n        self._task = asyncio.create_task(self._ticker(), name=\"talon:cron\")\n\n    async def stop(self) -> None:\n        \"\"\"Stop the scheduler ticker.\"\"\"\n        self._stopped.set()","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/talon/deepagents_talon/cron/scheduler.py#L32-L68","documentation":"ValueError raised in `Scheduler.__init__` (libs/talon/deepagents_talon/cron/scheduler.py:50) when `tick_seconds` is zero or negative. The ticker loop sleeps `tick_seconds` between iterations, so a non-positive value would busy-loop or misbehave. The guard fires at construction time before any asyncio task starts.","triggerScenarios":"Constructing `Scheduler(store, run_job, deliver_result, tick_seconds=0)` or a negative value; computing tick_seconds from config where a divisor or env value resolved to 0.","commonSituations":"Env var like TICK_SECONDS unset/empty then coerced to 0; config math like `60/interval` with a huge interval rounding to 0; passing 0 hoping for 'as fast as possible'.","solutions":["Pass a positive float, e.g. `tick_seconds=1.0` (or omit it to use DEFAULT_TICK_SECONDS).","Clamp the value before constructing: `max(tick_seconds, 0.1)`.","Fix the config/env source so it yields a positive number instead of 0."],"exampleFix":"// before\nScheduler(store, run_job, deliver, tick_seconds=float(os.environ.get(\"TICK_SECONDS\", 0)))\n// after\nScheduler(store, run_job, deliver, tick_seconds=max(float(os.environ.get(\"TICK_SECONDS\", \"1\")), 0.1))","handlingStrategy":"validation","validationCode":"tick = float(raw_tick)\nif tick <= 0:\n    raise ValueError(f\"tick_seconds must be positive, got {tick}\")\nscheduler = Scheduler(store, run_job, deliver, tick_seconds=tick)","typeGuard":null,"tryCatchPattern":"try:\n    scheduler = Scheduler(store, run_job, deliver, tick_seconds=tick)\nexcept ValueError as exc:\n    logger.error(\"bad tick_seconds %r: %s\", tick, exc)\n    scheduler = Scheduler(store, run_job, deliver)  # fall back to default","preventionTips":["Never pass 0 or negative tick_seconds; omit the param to use the default.","Clamp computed values: `max(tick_seconds, 0.1)`.","Validate env-derived numbers before constructing the scheduler."],"tags":["scheduler","asyncio","validation","constructor"],"backgroundTag":"invalid-configuration-value","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}