{"record":{"id":"69082724b28ab005","repo":"Hmbown/CodeWhale","slug":"cloud-job-id-is-and-cannot-be-run-confirm-it-first-with","errorCode":null,"errorMessage":"Cloud job {id} is {} and cannot be run; confirm it first with `/dispatch confirm {id}`.","messagePattern":"Cloud job (.+?) is (.+?) and cannot be run; confirm it first with `/dispatch confirm (.+?)`\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/dispatch_runner.rs","lineNumber":83,"sourceCode":"/// Run one confirmed job end to end.\n///\n/// Requires the job to be `launching` (or `running`, for a resumed runner):\n/// a `proposed` job is refused — confirmation is the caller's explicit act,\n/// never the runner's. Every phase persists its transition so `/dispatch\n/// show` and `/jobs` stream real progress, and a `canceled` record at any\n/// checkpoint stops the run and tears the sandbox down.\npub fn run_confirmed_job(\n    store: &CloudJobStore,\n    id: &str,\n    launcher: &dyn DaytonaLauncher,\n    forge: &dyn ForgePr,\n) -> Result<CloudJob> {\n    let mut job = store.load(id)?;\n    if !matches!(\n        job.status,\n        CloudJobStatus::Launching | CloudJobStatus::Running\n    ) {\n        bail!(\n            \"Cloud job {id} is {} and cannot be run; confirm it first with `/dispatch confirm {id}`.\",\n            status_word(job.status)\n        );\n    }\n    match drive(store, &mut job, launcher, forge) {\n        Ok(()) => store.load(id),\n        Err(error) => {\n            let message = sanitize_error(&error.to_string());\n            // Re-load before writing any failure: a job the user canceled\n            // stays canceled — a later run error must not overwrite the\n            // user's terminal word with `failed`. The error is appended to\n            // the note instead. And if a cancel lands inside the load→save\n            // span of the failure write, the disk record (already\n            // `canceled`, with the user's note) wins and is left alone.\n            let current = match store.load(id) {\n                Ok(mut record) if record.status == CloudJobStatus::Canceled => {\n                    record.finished_unix =\n                        Some(record.finished_unix.unwrap_or_else(unix_timestamp));","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/dispatch_runner.rs#L65-L101","documentation":"run_confirmed_job only drives cloud jobs in Launching or Running status. Any other status (e.g. pending confirmation, done, cancelled, failed) cannot be run, and the error points at the `/dispatch confirm <id>` command as the required gate.","triggerScenarios":"Calling run_confirmed_job (directly or via spawn_confirmed_runner) with a job id whose stored CloudJobStatus is not Launching or Running — typically a job that was never confirmed, or one already completed/cancelled.","commonSituations":"Forgetting `/dispatch confirm <id>` after creating a job, retrying a job that already finished, or attempting to re-run a cancelled job.","solutions":["Run `/dispatch confirm <id>` first, then call run again","Check the job status with the dispatch overview/list command before running","Create a new job if the old one is terminal (done/cancelled/failed)"],"exampleFix":"// before\nrun_confirmed_job(store, \"job42\", ...)\n// after\n// confirm first via the command surface:\n// /dispatch confirm job42\nrun_confirmed_job(store, \"job42\", ...)","handlingStrategy":"validation","validationCode":"let job = store.load(id)?;\nif !matches!(job.status, CloudJobStatus::Launching | CloudJobStatus::Running) {\n    confirm_job(id)?; // /dispatch confirm <id>\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always confirm jobs before running them","Check job status before re-running a job id","Treat terminal-status jobs (done/cancelled/failed) as non-rerunnable; create a new job"],"tags":["state-machine","cloud-job","lifecycle"],"backgroundTag":"invalid-state-transition","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}