{"record":{"id":"7b936f5404f922e9","repo":"Hmbown/CodeWhale","slug":"cloud-agent-sandbox-entered-state-state","errorCode":null,"errorMessage":"Cloud agent sandbox entered state '{state}'.","messagePattern":"Cloud agent sandbox entered state '(.+?)'\\.","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/cloud_dispatch.rs","lineNumber":1608,"sourceCode":"        }\n        let url = Self::control_plane_url(&format!(\"sandbox/{}\", receipt.sandbox_id))?;\n        for _ in 0..READY_POLL_ATTEMPTS {\n            let response = Self::send_json(\n                reqwest::Method::GET,\n                &url,\n                &api_key,\n                serde_json::Value::Null,\n            );\n            match response {\n                Ok(response) if response.status().is_success() => {\n                    let text = response.text().unwrap_or_default();\n                    if let Ok(parsed) = serde_json::from_str::<serde_json::Value>(&text)\n                        && let Some(state) = parsed.get(\"state\").and_then(|v| v.as_str())\n                    {\n                        match state {\n                            \"started\" | \"ready\" => return Ok(()),\n                            \"error\" | \"destroyed\" | \"archived\" => {\n                                bail!(\"Cloud agent sandbox entered state '{state}'.\");\n                            }\n                            _ => {}\n                        }\n                    } else {\n                        return Ok(());\n                    }\n                }\n                Err(error) => return Err(error),\n                Ok(response) => {\n                    if response.status().as_u16() == 404 {\n                        bail!(\"Cloud agent sandbox disappeared before it was ready.\");\n                    }\n                }\n            }\n            std::thread::sleep(READY_POLL_INTERVAL);\n        }\n        bail!(\"Cloud agent sandbox was not ready in time.\");\n    }","sourceCodeStart":1590,"sourceCodeEnd":1626,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/cloud_dispatch.rs#L1590-L1626","documentation":"While polling sandbox readiness, the provider reported the sandbox reached a terminal bad state (`error`, `destroyed`, or `archived`) instead of `started`/`ready`. The wait aborts immediately since the sandbox will never become ready.","triggerScenarios":"A poll response's `state` field equals \"error\", \"destroyed\", or \"archived\" — e.g. the sandbox crashed at boot, was reaped by the provider, or was archived for inactivity before first use.","commonSituations":"Provider capacity issues causing sandbox boot errors, very short sandbox TTLs, someone else deleting the sandbox, image/setup failure.","solutions":["Re-dispatch the job to create a fresh sandbox","Check the Daytona dashboard/logs for why the sandbox errored or was destroyed","Increase sandbox TTL or keep-alive settings if archiving is the cause","Retry during lower provider load if boot errors cluster"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"match wait_ready(&receipt) {\n    Err(e) if e.to_string().contains(\"state '\") && is_terminal_bad_state(&e) => re_dispatch(job),\n    Err(e) => bail!(e),\n    Ok(()) => {}\n}","preventionTips":["Set sandbox TTL/keep-alive long enough for job start","Watch provider dashboards for boot-error rates","Alert on 'destroyed'/'archived' states observed shortly after create"],"tags":["cloud","daytona","lifecycle","sandbox"],"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-22T21:17:16.096Z"}