{"record":{"id":"6f6680c714747175","repo":"affaan-m/ECC","slug":"cron-expression-expr-did-not-yield-a-future-ru","errorCode":null,"errorMessage":"cron expression `{expr}` did not yield a future run time","messagePattern":"cron expression `(.+?)` did not yield a future run time","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/session/manager.rs","lineNumber":2382,"sourceCode":"        fields => {\n            anyhow::bail!(\n                \"invalid cron expression `{trimmed}`: expected 5, 6, or 7 fields but found {fields}\"\n            )\n        }\n    };\n    CronSchedule::from_str(&normalized)\n        .with_context(|| format!(\"invalid cron expression `{trimmed}`\"))\n}\n\nfn next_schedule_run_at(\n    expr: &str,\n    after: chrono::DateTime<chrono::Utc>,\n) -> Result<chrono::DateTime<chrono::Utc>> {\n    parse_cron_schedule(expr)?\n        .after(&after)\n        .next()\n        .map(|value| value.with_timezone(&chrono::Utc))\n        .ok_or_else(|| anyhow::anyhow!(\"cron expression `{expr}` did not yield a future run time\"))\n}\n\npub async fn run_session(\n    cfg: &Config,\n    session_id: &str,\n    task: &str,\n    agent_type: &str,\n    working_dir: &Path,\n) -> Result<()> {\n    let db = StateStore::open(&cfg.db_path)?;\n    let session = resolve_session(&db, session_id)?;\n\n    if session.state != SessionState::Pending {\n        tracing::info!(\n            \"Skipping run_session for {} because state is {}\",\n            session_id,\n            session.state\n        );","sourceCodeStart":2364,"sourceCodeEnd":2400,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/session/manager.rs#L2364-L2400","documentation":"Raised when a parsed cron expression cannot produce any next run time after the given anchor. Valid-looking expressions may still be unsatisfiable, e.g. Feb 30, or dates excluded by day-of-month/day-of-week restrictions. The scheduler refuses to register a schedule it can never fire.","triggerScenarios":"Scheduling a session with a cron expression whose next occurrence after `now` does not exist (e.g. '0 0 30 2 *' — Feb 30) or whose only matching dates are in the past.","commonSituations":"Hand-written cron strings with impossible dates; copy-pasted cron from another tool using 6/7-field syntax with seconds misaligned; time-zone assumptions making the expected first run already past.","solutions":["Validate the cron expression with a checker before scheduling; remove impossible date fields (Feb 30)","Use a simpler expression (e.g. daily wildcard) to confirm scheduling works, then tighten it","Check that day-of-month and day-of-week fields are not mutually restrictive (use * in one)"],"exampleFix":"// before\nschedule: \"0 0 30 2 *\"   // Feb 30 never exists\n// after\nschedule: \"0 0 1 3 *\"    // March 1st instead","handlingStrategy":"validation","validationCode":"use cron::Schedule;\nlet sched: Schedule = expr.parse()?;\nif sched.after(&chrono::Utc::now()).next().is_none() {\n    anyhow::bail!(\"cron `{expr}` has no future occurrence\");\n}","typeGuard":null,"tryCatchPattern":"match next_cron_run(expr, now) {\n    Ok(t) => schedule_at(t),\n    Err(e) => eprintln!(\"bad schedule: {e}; fix the cron expression\"),\n}","preventionTips":["Validate cron strings with a parser/linter before saving config","Avoid impossible dates (Feb 30) and over-restrictive day fields","Prefer standard 5-field crontab syntax"],"tags":["rust","cron","scheduling","date"],"backgroundTag":"invalid-date-format","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}