{"record":{"id":"49644a919895db34","repo":"astrid-runtime/astrid","slug":"mcp-gateway-did-not-become-ready-within-seconds","errorCode":null,"errorMessage":"MCP gateway did not become ready within {} seconds","messagePattern":"MCP gateway did not become ready within (.+?) seconds","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/mcp/lifecycle.rs","lineNumber":494,"sourceCode":"                if Instant::now() >= deadline {\n                    anyhow::bail!(\n                        \"MCP gateway is starting but has not published readiness within {} seconds\",\n                        SPAWNED_READY_TIMEOUT.as_secs()\n                    );\n                }\n                tokio::time::sleep(READY_POLL).await;\n                continue;\n            };\n            clean_unowned_gateway_startup(&lifecycle)\n                .await\n                .context(\"shutdown stage gateway.startup_cleanup\")?;\n            spawn_gateway(principal)?;\n            drop(lifecycle);\n            drop(supervisor);\n            spawned = true;\n        }\n        if Instant::now() >= deadline {\n            anyhow::bail!(\n                \"MCP gateway did not become ready within {} seconds\",\n                SPAWNED_READY_TIMEOUT.as_secs()\n            );\n        }\n        tokio::time::sleep(READY_POLL).await;\n    }\n}\n\n/// Stop the persistent gateway through its owner-authenticated control path.\n///\n/// Success means the gateway returned its final teardown ACK, its recorded\n/// process exited, the listener is absent, and the exact readiness record is\n/// gone. Inconsistent or unowned state is left intact and reported.\npub(crate) async fn stop_gateway() -> Result<()> {\n    let socket = gateway_socket_path()?;\n    // A fresh or already-clean runtime has no gateway generation to lock.\n    // Acquiring the lifecycle lock here would create the transient root before\n    // admission, which is forbidden for the stopped durable layout.","sourceCodeStart":476,"sourceCodeEnd":512,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/mcp/lifecycle.rs#L476-L512","documentation":"Fired by wait_for_gateway when, after cleaning unowned startup state and spawning a gateway child, the gateway still has not published readiness before the overall deadline. Spawn-and-wait has exhausted its retry budget.","triggerScenarios":"Thrown at crates/astrid-cli/src/commands/mcp/lifecycle.rs:494 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read gateway logs to find the startup failure","Start the gateway manually to surface the error","Check socket path permissions and stale startup state"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}