{"record":{"id":"87b381c6b280e17d","repo":"affaan-m/ECC","slug":"scheduled-task-not-found-schedule-id","errorCode":null,"errorMessage":"Scheduled task not found: {schedule_id}","messagePattern":"Scheduled task not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/main.rs","lineNumber":2710,"sourceCode":"                } else if schedules.is_empty() {\n                    println!(\"No scheduled tasks\");\n                } else {\n                    println!(\"Scheduled tasks\");\n                    for schedule in schedules {\n                        println!(\n                            \"#{} {} [{}] | {} | next {}\",\n                            schedule.id,\n                            schedule.task,\n                            schedule.agent_type,\n                            schedule.cron_expr,\n                            schedule.next_run_at.to_rfc3339()\n                        );\n                    }\n                }\n            }\n            ScheduleCommands::Remove { schedule_id } => {\n                if !session::manager::delete_scheduled_task(&db, schedule_id)? {\n                    anyhow::bail!(\"Scheduled task not found: {schedule_id}\");\n                }\n                println!(\"Removed scheduled task {schedule_id}\");\n            }\n            ScheduleCommands::RunDue { limit, json } => {\n                let outcomes = session::manager::run_due_schedules(&db, &cfg, limit).await?;\n                if json {\n                    println!(\"{}\", serde_json::to_string_pretty(&outcomes)?);\n                } else if outcomes.is_empty() {\n                    println!(\"No due scheduled tasks\");\n                } else {\n                    println!(\"Dispatched {} scheduled task(s)\", outcomes.len());\n                    for outcome in outcomes {\n                        println!(\n                            \"#{} -> {} | {} | next {}\",\n                            outcome.schedule_id,\n                            short_session(&outcome.session_id),\n                            outcome.task,\n                            outcome.next_run_at.to_rfc3339()","sourceCodeStart":2692,"sourceCodeEnd":2728,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/ecc2/src/main.rs#L2692-L2728","documentation":"Thrown by `schedule remove` when `session::manager::delete_scheduled_task(&db, schedule_id)` returns `false`, indicating no row matched the given schedule ID for deletion. The manager signals \"not found\" via a boolean rather than an error, and the CLI promotes it to a bail so the user knows nothing was removed. The success path prints `Removed scheduled task {schedule_id}`.","triggerScenarios":"Running `ecc schedule remove <id>` with an ID that does not exist in the schedules table. Re-running a removal after the task was already deleted. Passing an ID from a different state store or a typo in the numeric ID.","commonSituations":"Idempotency assumptions — calling remove twice. Stale schedule IDs after a DB reset. Operating on the wrong workspace whose schedule table is empty.","solutions":["List current schedules with `ecc schedule list` to find a valid ID.","If the task was already removed, treat the error as success and skip.","Confirm the state store path matches the workspace where the schedule was created."],"exampleFix":"// before\necc schedule remove 9999\n\n// after\necc schedule list              # confirm id\necc schedule remove <valid-id>","handlingStrategy":"validation","validationCode":"// Idempotent remove in calling code\nfn safe_remove(db: &StateStore, id: i64) -> Result<()> {\n    if session::manager::delete_scheduled_task(db, id)? {\n        println!(\"removed schedule {id}\");\n    } else {\n        println!(\"schedule {id} already absent\");\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":"match session::manager::delete_scheduled_task(&db, schedule_id) {\n    Ok(true) => println!(\"Removed scheduled task {schedule_id}\"),\n    Ok(false) => eprintln!(\"Scheduled task not found: {schedule_id} (nothing to remove)\"),\n    Err(e) => return Err(e),\n}","preventionTips":["Treat removal as idempotent in automation: a missing row is not an error.","List schedules before removing to confirm IDs.","Pin automation to the same state store that created the schedule."],"tags":["schedule","database","cli"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}