{"record":{"id":"8e31c014df211b96","repo":"astrid-runtime/astrid","slug":"candidate-generation-for-id-exited-before-sign","errorCode":null,"errorMessage":"candidate generation for '{id}' exited before signaling ready","messagePattern":"candidate generation for '(.+?)' exited before signaling ready","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/astrid-kernel/src/lib.rs","lineNumber":4722,"sourceCode":"    use astrid_capsule::capsule::ReadyStatus;\n\n    let activation_timeout = std::time::Duration::from_secs(30);\n    let readiness_timeout = std::time::Duration::from_millis(500);\n    match astrid_runtime::time::timeout(activation_timeout, candidate.activate()).await {\n        Ok(result) => result?,\n        Err(_) => anyhow::bail!(\n            \"candidate generation for '{id}' did not activate within {}ms\",\n            activation_timeout.as_millis()\n        ),\n    }\n    match candidate.wait_ready(readiness_timeout).await {\n        ReadyStatus::Ready => Ok(()),\n        ReadyStatus::Timeout => anyhow::bail!(\n            \"candidate generation for '{id}' did not signal ready within {}ms\",\n            readiness_timeout.as_millis()\n        ),\n        ReadyStatus::Crashed => {\n            anyhow::bail!(\"candidate generation for '{id}' exited before signaling ready\")\n        },\n    }\n}\n\n/// Attempts to restart a failed capsule, respecting backoff and max retries.\n///\n/// Records ONE restart attempt (advancing backoff and the retry count) per call\n/// when eligible. The count is a measure of CONSECUTIVE health failures: a busy\n/// capsule whose restart legitimately leaves a lingering old instance is NOT\n/// treated as a failure here — the tracker is pruned by the health monitor the\n/// moment the capsule RECOVERS (see the retain in [`spawn_capsule_health_monitor`]),\n/// so only a capsule that keeps failing across ticks accumulates toward the cap.\n/// This deliberately does not key off the [`RestartOutcome`], which is diagnostic\n/// only: keying the cap off \"lingering\" would let a busy-but-healthy capsule\n/// (whose consumer holds a clone for up to its 60s idle grace) exhaust the cap\n/// and be permanently disabled.\n#[cfg(not(all(target_arch = \"wasm32\", target_os = \"unknown\")))]\nasync fn attempt_capsule_restart(","sourceCodeStart":4704,"sourceCodeEnd":4740,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/lib.rs#L4704-L4740","documentation":"This error is thrown when `candidate.wait_ready()` returns `ReadyStatus::Crashed`, meaning the candidate capsule process exited (crashed) before it could signal Ready. It indicates an abnormal termination during startup rather than a timeout.","triggerScenarios":"`candidate.wait_ready(readiness_timeout)` returns `ReadyStatus::Crashed` — the capsule process died between activation and readiness signaling.","commonSituations":"Capsule panics or aborts during initialization; missing runtime dependencies (shared libs, config, env vars) causing immediate exit; bad binary/entrypoint; OOM kill of the capsule process during startup.","solutions":["Inspect the capsule's logs/stderr for panics, aborts, or OOM kills during startup.","Verify the capsule binary and its runtime dependencies (config, env, native libs) are present and valid.","Reproduce the capsule's startup in isolation to surface the crash before it is managed by the kernel.","Check memory limits on the host/runtime that might kill the process mid-startup."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-launch sanity: verify the capsule binary exists, is executable, and its\n// config/env dependencies resolve before calling activate()","typeGuard":null,"tryCatchPattern":"match candidate.wait_ready(readiness_timeout).await {\n    ReadyStatus::Crashed => {\n        log::error!(\"capsule exited before ready; collecting stderr/coredump\");\n        // surface capsule logs, do not blind-retry\n    }\n    _ => {}\n}","preventionTips":["Smoke-test capsule startup in isolation before kernel-managed activation","Pin and verify runtime dependencies (libs, env, config) in the capsule image","Set sane memory limits so the process isn't OOM-killed at startup","Capture and retain capsule stderr for crash diagnosis"],"tags":["crash","startup","capsule","process"],"backgroundTag":"process-crashed-before-ready","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}