langchain-ai/deepagents · error · CronJobError
schedule must look like 'in 30m' or 'every 15m'
Error message
schedule must look like 'in 30m' or 'every 15m'
What it means
This error is raised by CronSchedule.parse when the given schedule string does not start with either 'in ' (one-shot delay) or 'every ' (recurring interval) after lowercasing and whitespace-normalizing. The library only supports these two human-readable relative-duration formats, and anything else (including absolute times, cron expressions, or unsupported prefixes like 'at ' or 'daily') is rejected. It is a CronJobError, so callers can catch it specifically.
Source
Thrown at libs/talon/deepagents_talon/cron/jobs.py:150
def parse(cls, value: str) -> CronSchedule:
"""Parse a supported schedule string.
Args:
value: Schedule text such as `in 30m` or `every 15m`.
Returns:
Parsed schedule.
Raises:
CronJobError: If the schedule string is unsupported.
"""
text = " ".join(value.strip().lower().split())
if text.startswith("in "):
return cls(kind="one_shot", minutes=_parse_duration_minutes(text[3:]), display=value)
if text.startswith("every "):
return cls(kind="recurring", minutes=_parse_duration_minutes(text[6:]), display=value)
msg = "schedule must look like 'in 30m' or 'every 15m'"
raise CronJobError(msg)
def next_after(self, now: datetime) -> datetime:
"""Return the next scheduled run after `now`.
Args:
now: Current timestamp.
Returns:
Next run timestamp.
"""
return now + timedelta(minutes=self.minutes)
def to_dict(self) -> CronScheduleDict:
"""Serialize this schedule for disk storage.
Returns:
JSON-compatible schedule dictionary.
"""View on GitHub (pinned to a1af029e6e)
Solutions
- Prefix the duration with 'in ' for one-shot schedules or 'every ' for recurring ones, e.g. 'in 30m' or 'every 15m'
- Normalize the value yourself before calling parse: text = ' '.join(value.strip().lower().split()) and prepend the missing prefix based on intent
- If the user supplied an absolute time or cron expression, convert it to a relative duration first — parse does not support those formats
- Catch CronJobError and surface the accepted format hint to the end user instead of crashing
Example fix
// before
schedule = CronSchedule.parse("30m")
// after
schedule = CronSchedule.parse("in 30m") # one-shot
# or
schedule = CronSchedule.parse("every 15m") # recurring Defensive patterns
Strategy: validation
Validate before calling
import re
_DURATION = re.compile(r"^(in|every)\s+\d+\s*(s|m|h|d)$")
def is_valid_schedule(value: str) -> bool:
text = " ".join(value.strip().lower().split())
return _DURATION.match(text) is not None
if not is_valid_schedule(user_input):
raise ValueError(f"schedule must look like 'in 30m' or 'every 15m', got {user_input!r}") Try / catch
try:
schedule = CronSchedule.parse(user_input)
except CronJobError as exc:
logger.warning("invalid schedule %r: %s", user_input, exc)
schedule = None # or re-prompt / apply a default Prevention
- Always build schedule strings via the 'in <dur>' / 'every <dur>' templates instead of free text
- Lowercase and strip/normalize whitespace before calling parse
- Sanitize UI input against a duration regex before submitting
- Never pass cron expressions or absolute timestamps to parse — convert them first
When it happens
Trigger: Calling parse (directly or via create_job/edit_job) with a value like '30m', 'daily', 'at 5pm', 'every', 'in', or 'Every 15 MINUTES ' where the normalized text lacks the required 'in ' or 'every ' prefix. A trailing/leading whitespace-only string or an empty string also lands here.
Common situations: Passing a cron expression ('0 9 * * *') or ISO timestamp instead of a relative duration; forgetting the 'in '/'every ' prefix while supplying just the duration ('30m'); building UI input that lets users type arbitrary schedule text; locale-formatted strings with uppercase letters or extra spaces that survive normalization but have the wrong prefix.
Related errors
- cron schedules must be at least 1 minute
- repeat cap must be at least 1
- repeat completed count cannot be negative
- repeat cap is only valid for recurring jobs
- cron retention window cannot be negative
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/490ee3b431732437.
Report an issue: GitHub.