langchain-ai/deepagents · error · CronJobError
cron job not found in current conversation: {job_id}
Error message
cron job not found in current conversation: {job_id} What it means
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.
Source
Thrown at libs/talon/deepagents_talon/cron/jobs.py:486
new_repeat = job.repeat
if repeat_times is not None:
if new_schedule.kind != "recurring":
msg = "repeat cap is only valid for recurring jobs"
raise CronJobError(msg)
new_repeat = CronRepeat(times=repeat_times)
updated = replace(
job,
name=job.name if name is None else name,
prompt=job.prompt if prompt is None else prompt,
schedule=new_schedule,
repeat=new_repeat,
enabled=job.enabled if enabled is None else enabled,
next_run_at=next_run_at,
)
result.append(updated)
if updated is None:
msg = f"cron job not found in current conversation: {job_id}"
raise CronJobError(msg)
self._write_jobs(result)
return updated
def remove_job(self, job_id: str, *, origin: CronOrigin) -> CronJob:
"""Remove a job within the current conversation scope.
Args:
job_id: Job identifier.
origin: Required conversation scope.
Returns:
Removed job.
Raises:
CronJobError: If no scoped job matches.
"""
jobs = self.list_jobs()
removed: CronJob | None = NoneView on GitHub (pinned to a1af029e6e)
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.
Example fix
// before
store.edit_job("job_abc", origin=origin, enabled=False)
// after
existing = [j for j in store.list_jobs() if j.id == "job_abc"]
if existing:
store.edit_job("job_abc", origin=origin, enabled=False)
else:
job = store.create_job(prompt="...", schedule=schedule, origin=origin)
store.edit_job(job.id, origin=origin, enabled=False) Defensive patterns
Strategy: try-catch
Validate before calling
existing = [j for j in store.list_jobs() if j.id == job_id]
if not existing:
raise LookupError(f"job {job_id} not in this conversation; create it first") Type guard
def job_in_scope(store, job_id: str, origin) -> bool:
return any(j.id == job_id for j in store.list_jobs()) Try / catch
try:
store.edit_job(job_id, origin=origin, enabled=False)
except CronJobError as exc:
logger.warning("edit skipped: %s", exc) Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Thread not found: {value}
- MCPServerInfo {self.name!r}: pending_reconnect requires stat
- Error: Skill '{skill_name}' not found.
- {sandbox_id}
- cron schedules must be at least 1 minute
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/f0ba7d75aee615b0.
Report an issue: GitHub.