{"record":{"id":"f0ba7d75aee615b0","repo":"langchain-ai/deepagents","slug":"cron-job-not-found-in-current-conversation-job-i","errorCode":null,"errorMessage":"cron job not found in current conversation: {job_id}","messagePattern":"cron job not found in current conversation: (.+?)","errorType":"exception","errorClass":"CronJobError","httpStatus":null,"severity":"error","filePath":"libs/talon/deepagents_talon/cron/jobs.py","lineNumber":486,"sourceCode":"            new_repeat = job.repeat\n            if repeat_times is not None:\n                if new_schedule.kind != \"recurring\":\n                    msg = \"repeat cap is only valid for recurring jobs\"\n                    raise CronJobError(msg)\n                new_repeat = CronRepeat(times=repeat_times)\n            updated = replace(\n                job,\n                name=job.name if name is None else name,\n                prompt=job.prompt if prompt is None else prompt,\n                schedule=new_schedule,\n                repeat=new_repeat,\n                enabled=job.enabled if enabled is None else enabled,\n                next_run_at=next_run_at,\n            )\n            result.append(updated)\n        if updated is None:\n            msg = f\"cron job not found in current conversation: {job_id}\"\n            raise CronJobError(msg)\n        self._write_jobs(result)\n        return updated\n\n    def remove_job(self, job_id: str, *, origin: CronOrigin) -> CronJob:\n        \"\"\"Remove a job within the current conversation scope.\n\n        Args:\n            job_id: Job identifier.\n            origin: Required conversation scope.\n\n        Returns:\n            Removed job.\n\n        Raises:\n            CronJobError: If no scoped job matches.\n        \"\"\"\n        jobs = self.list_jobs()\n        removed: CronJob | None = None","sourceCodeStart":468,"sourceCodeEnd":504,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/talon/deepagents_talon/cron/jobs.py#L468-L504","documentation":"CronJobStore.edit_job looks up jobs by both id and conversation origin scope; if no stored job matches the given job_id within the current conversation's origin, it raises CronJobError. The store filters jobs by _same_origin_scope, so a job that exists but belongs to a different conversation is invisible here. This prevents one conversation from editing another conversation's scheduled jobs.","triggerScenarios":"Calling store.edit_job(job_id, origin=...) with a job_id that (a) was never created, (b) was already removed by remove_job or pruned by prune_completed, or (c) exists in the store but was created under a different CronOrigin (different conversation/thread).","commonSituations":"Passing a stale job id after a session restart or conversation switch; hardcoding a job id from another conversation's output; a job being auto-pruned by retention cleanup before the edit; typos or re-serialization of the id losing characters.","solutions":["Call store.list_jobs(origin=...) (or list_jobs with the same origin) and verify the job_id exists in the current conversation before calling edit_job.","Check that the origin passed to edit_job matches the origin used at create_job time (same conversation scope).","Recreate the job with create_job if it was removed or pruned, then apply the edit."],"exampleFix":"// before\nstore.edit_job(\"job_abc\", origin=origin, enabled=False)\n// after\nexisting = [j for j in store.list_jobs() if j.id == \"job_abc\"]\nif existing:\n    store.edit_job(\"job_abc\", origin=origin, enabled=False)\nelse:\n    job = store.create_job(prompt=\"...\", schedule=schedule, origin=origin)\n    store.edit_job(job.id, origin=origin, enabled=False)","handlingStrategy":"try-catch","validationCode":"existing = [j for j in store.list_jobs() if j.id == job_id]\nif not existing:\n    raise LookupError(f\"job {job_id} not in this conversation; create it first\")","typeGuard":"def job_in_scope(store, job_id: str, origin) -> bool:\n    return any(j.id == job_id for j in store.list_jobs())","tryCatchPattern":"try:\n    store.edit_job(job_id, origin=origin, enabled=False)\nexcept CronJobError as exc:\n    logger.warning(\"edit skipped: %s\", exc)","preventionTips":["Always resolve job ids from list_jobs() in the same origin scope instead of caching ids across sessions.","Pass the exact same CronOrigin used at creation time.","Account for pruning: a completed one-shot job may have been removed before you edit it."],"tags":["cron","not-found","scope-mismatch","state-management"],"backgroundTag":"resource-not-found","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}