{"record":{"id":"64493c5b6cf912cb","repo":"astrid-runtime/astrid","slug":"candidate-generation-for-id-did-not-activate-w","errorCode":null,"errorMessage":"candidate generation for '{id}' did not activate within {}ms","messagePattern":"candidate generation for '(.+?)' did not activate within (.+?)ms","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-kernel/src/lib.rs","lineNumber":4710,"sourceCode":"        strong_count = Arc::strong_count(previous),\n        \"Old capsule generation remains referenced after replacement; autonomous \\\n         work was cancelled and memory reclaims when the last reference drops\"\n    );\n    RestartOutcome::OldInstanceLingering\n}\n\n#[cfg(not(all(target_arch = \"wasm32\", target_os = \"unknown\")))]\nasync fn activate_and_wait_ready(\n    id: &astrid_capsule_types::CapsuleId,\n    candidate: &mut dyn astrid_capsule::capsule::Capsule,\n) -> Result<(), anyhow::Error> {\n    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///","sourceCodeStart":4692,"sourceCodeEnd":4728,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-kernel/src/lib.rs#L4692-L4728","documentation":"This error fires when a candidate capsule generation fails to complete its async `activate()` future within the 30-second activation timeout enforced by the kernel. It means the capsule process accepted activation but never returned from the activation phase in time. The kernel bails out so the candidate can be discarded or retried under backoff.","triggerScenarios":"Calling the kernel's candidate activation path where `astrid_runtime::time::timeout(activation_timeout, candidate.activate())` returns `Err(_)` (elapsed), i.e. `activate()` takes longer than 30s or hangs.","commonSituations":"Capsule startup blocked on slow I/O or network calls; deadlock or livelock inside the capsule's activation routine; overloaded host making process init extremely slow; a capsule whose activate() awaits an external dependency that is unreachable.","solutions":["Inspect the candidate capsule's activate() implementation for blocking or hanging awaits (network, locks, unbounded waits).","Check host resource pressure (CPU/memory) and any external services the capsule contacts during activation.","If legitimately slow activation is expected, raise the 30s `activation_timeout` in the kernel's activation path.","Rely on the kernel's restart/backoff logic to retry the candidate after fixing the root cause."],"exampleFix":"// before\nlet activation_timeout = std::time::Duration::from_secs(30);\n// after\nlet activation_timeout = std::time::Duration::from_secs(120); // capsule needs longer startup","handlingStrategy":"try-catch","validationCode":"// Rust: nothing cheap to pre-check; ensure the capsule's deps are reachable\n// e.g. health-check external services and confirm binary/config exist before activation","typeGuard":null,"tryCatchPattern":"match astrid_runtime::time::timeout(Duration::from_secs(30), candidate.activate()).await {\n    Ok(result) => result?,\n    Err(_) => { log::warn!(\"activation timed out; will retry with backoff\"); /* retry or discard candidate */ }\n}","preventionTips":["Keep capsule activate() non-blocking and free of long external awaits","Add startup instrumentation/logging to capsules to find slow activation phases","Size the activation timeout to the slowest legitimate startup, plus margin"],"tags":["timeout","activation","async","capsule"],"backgroundTag":"request-timeout","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"}