affaan-m/ECC · error
Scheduled task not found
Error message
Scheduled task not found: {schedule_id} What it means
The `schedule remove` CLI command calls `session::manager::delete_scheduled_task`, which returns false when no scheduled task with the given ID exists in the state store; the command then bails with a not-found message naming the ID. This distinguishes "nothing to delete" from a successful removal.
Solutions
- Verify the schedule ID exists (list scheduled tasks) before removing.
- Check you are pointing at the same state store/database the task was created in.
- Make removal scripts idempotent by ignoring this error when the task is already gone.
Example fix
// before
if !session::manager::delete_scheduled_task(&db, id)? {
anyhow::bail!("Scheduled task not found: {id}");
}
// after
if !session::manager::delete_scheduled_task(&db, id)? {
eprintln!("Scheduled task not found (already removed): {id}");
return Ok(()); // treat as idempotent success
} Defensive patterns
Strategy: try-catch
Try / catch
if let Err(e) = remove_schedule(&db, id) {
if e.to_string().contains("Scheduled task not found") {
eprintln!("Task {} already removed; treating as success", id);
} else {
return Err(e);
}
} Prevention
- List scheduled tasks to confirm the ID before removing
- Confirm the command uses the same database/state store the task was created in
- Write cleanup scripts to tolerate already-deleted IDs
When it happens
Trigger: Running the schedule remove command with a `schedule_id` that was already removed, never created, or mistyped.
Common situations: Re-running cleanup scripts that delete tasks idempotently, stale IDs from a wiped or different database file, or copy-pasted IDs with typos.
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
- artifact not found
- Context graph entity not found
- Session not found
- Session not found
- Unknown memory connector
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/87b381c6b280e17d.
Report an issue: GitHub.
Appendix: source
Thrown at ecc2/src/main.rs:2710
} else if schedules.is_empty() {
println!("No scheduled tasks");
} else {
println!("Scheduled tasks");
for schedule in schedules {
println!(
"#{} {} [{}] | {} | next {}",
schedule.id,
schedule.task,
schedule.agent_type,
schedule.cron_expr,
schedule.next_run_at.to_rfc3339()
);
}
}
}
ScheduleCommands::Remove { schedule_id } => {
if !session::manager::delete_scheduled_task(&db, schedule_id)? {
anyhow::bail!("Scheduled task not found: {schedule_id}");
}
println!("Removed scheduled task {schedule_id}");
}
ScheduleCommands::RunDue { limit, json } => {
let outcomes = session::manager::run_due_schedules(&db, &cfg, limit).await?;
if json {
println!("{}", serde_json::to_string_pretty(&outcomes)?);
} else if outcomes.is_empty() {
println!("No due scheduled tasks");
} else {
println!("Dispatched {} scheduled task(s)", outcomes.len());
for outcome in outcomes {
println!(
"#{} -> {} | {} | next {}",
outcome.schedule_id,
short_session(&outcome.session_id),
outcome.task,
outcome.next_run_at.to_rfc3339()View on GitHub (pinned to 8321021c54)