langchain-ai/deepagents · error · CronJobError

schedule duration must be at least 1 minute

Error message

schedule duration must be at least 1 minute

What it means

CronJobError raised by `_positive_int` in libs/talon/deepagents_talon/cron/jobs.py when a parsed schedule duration is below MIN_GRANULARITY_MINUTES (1 minute). The scheduler's finest tick granularity is one minute, so sub-minute schedules are meaningless and rejected rather than silently rounded.

Source

Thrown at libs/talon/deepagents_talon/cron/jobs.py:697

        msg = "schedule duration must be a single value such as '30m'"
        raise CronJobError(msg)
    text = parts[0]
    if text.endswith("m"):
        return _positive_int(text[:-1])
    if text.endswith("h"):
        return _positive_int(text[:-1]) * 60
    msg = "schedule duration must use 'm' for minutes or 'h' for hours"
    raise CronJobError(msg)


def _positive_int(value: str) -> int:
    if not value.isdecimal():
        msg = "schedule duration must be a positive integer"
        raise CronJobError(msg)
    number = int(value)
    if number < MIN_GRANULARITY_MINUTES:
        msg = "schedule duration must be at least 1 minute"
        raise CronJobError(msg)
    return number


def _same_origin_scope(left: CronOrigin, right: CronOrigin) -> bool:
    return left.conversation_id == right.conversation_id and left.channel == right.channel


def _coerce_utc(value: datetime | None = None) -> datetime:
    if value is None:
        return datetime.now(UTC)
    if value.tzinfo is None:
        return value.replace(tzinfo=UTC)
    return value.astimezone(UTC)


def _format_optional_time(value: datetime | None) -> str | None:
    return None if value is None else _format_time(value)

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Use a duration of at least 1 minute ('1m' or more).
  2. If the job should fire immediately, invoke the job directly instead of scheduling it with a 0 duration.
  3. Audit templates/config so duration variables cannot evaluate to 0.

Example fix

// before
parse("0m", ...)
// after
parse("1m", ...)
Defensive patterns

Strategy: validation

Validate before calling

def validate_min_duration(text: str) -> bool:
    num = int(text[:-1]) if text[:-1].isdecimal() else 0
    minutes = num if text.endswith("m") else num * 60
    return minutes >= 1

Try / catch

try:
    job = parse(schedule)
except CronJobError as exc:
    if "at least 1 minute" in str(exc):
        schedule = "1m"  # or run the job immediately
    else:
        raise

Prevention

When it happens

Trigger: Passing '0m', '0h', or any duration that parses to a value < 1 minute (e.g. '0h' equals 0 minutes) to `parse`. The integer parses fine but fails the `number < MIN_GRANULARITY_MINUTES` check.

Common situations: Trying to schedule a job to run 'immediately' with '0m'; templated durations where a variable defaulted to 0; porting sub-minute intervals from other systems.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/cea932d11f76c6fa. Report an issue: GitHub.