{"record":{"id":"114c7bd3a7227e77","repo":"astrid-runtime/astrid","slug":"mcp-gateway-pid-is-alive-but-its-listener-is-un","errorCode":null,"errorMessage":"MCP gateway PID {} is alive but its listener is unavailable","messagePattern":"MCP gateway PID (.+?) is alive but its listener is unavailable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/mcp/lifecycle.rs","lineNumber":434,"sourceCode":"                    principal\n                );\n            }\n            match astrid_core::local_transport::connect_outcome(&socket)\n                .await\n                .context(\"failed to inspect MCP gateway endpoint\")?\n            {\n                astrid_core::local_transport::ConnectOutcome::Connected(stream) => {\n                    request_gateway_control(stream, &record, GatewayControlOperation::Health)\n                        .await\n                        .context(\"MCP gateway cannot prove a recoverable daemon uplink\")?;\n                    emit_ready(format, &record)?;\n                    return Ok(ExitCode::SUCCESS);\n                },\n                astrid_core::local_transport::ConnectOutcome::Absent\n                | astrid_core::local_transport::ConnectOutcome::Stale\n                    if crate::commands::daemon_control::is_process_alive(record.pid) =>\n                {\n                    anyhow::bail!(\n                        \"MCP gateway PID {} is alive but its listener is unavailable\",\n                        record.pid\n                    );\n                },\n                astrid_core::local_transport::ConnectOutcome::Absent\n                | astrid_core::local_transport::ConnectOutcome::Stale => {\n                    remove_dead_gateway_markers(&record).await?;\n                },\n            }\n        }\n        if !spawned {\n            let supervisor = try_acquire_gateway_supervisor()?;\n            let Some(supervisor) = supervisor else {\n                if Instant::now() >= deadline {\n                    anyhow::bail!(\n                        \"MCP gateway startup supervisor remained active within {} seconds\",\n                        SPAWNED_READY_TIMEOUT.as_secs()\n                    );","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/mcp/lifecycle.rs#L416-L452","documentation":"Fired by wait_for_gateway when the ready-record PID is alive but the socket connection outcome is Absent or Stale: the gateway process exists yet its listener is unusable. This is a hung/broken gateway that cannot recover on its own without proven daemon uplink.","triggerScenarios":"Thrown at crates/astrid-cli/src/commands/mcp/lifecycle.rs:434 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Kill or stop the wedged gateway process and retry","Check gateway logs for the bind/listen failure","Clean the dead gateway markers and let wait_for_gateway spawn a fresh child"],"exampleFix":null,"handlingStrategy":"fallback","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"}