{"record":{"id":"a975f5838ea5c078","repo":"xai-org/grok-build","slug":"32601","errorCode":"-32601","errorMessage":"{context} does not handle WaitForTerminalExit","messagePattern":"(.+?) does not handle WaitForTerminalExit","errorType":"error_code","errorClass":"acp::Error","httpStatus":null,"severity":"info","filePath":"crates/codegen/xai-grok-pager/src/acp/mod.rs","lineNumber":47,"sourceCode":"\nuse anyhow::Result;\nuse tokio_util::sync::CancellationToken;\n\nuse crate::client_identity::{HEADLESS_CLIENT_TYPE, PAGER_CLIENT_TYPE, PAGER_CLIENT_VERSION};\nuse agent_client_protocol as acp;\nuse xai_acp_lib::{AcpAgentTx, AcpClientRx, acp_send};\nuse xai_grok_shell::agent::auth_method::AuthMethodKind;\nuse xai_grok_shell::agent::config::Config as AgentConfig;\nuse xai_grok_shell::sampling::types::ReasoningEffort;\n\npub use model_state::ModelState;\n\n/// Construct a `METHOD_NOT_FOUND` error for `WaitForTerminalExit`.\n///\n/// Both the interactive pager and headless mode reject this ACP method (the adapter falls back to polling).\n/// Centralised here so the error code and message format stay in sync.\npub(crate) fn wait_for_exit_not_supported(context: &str) -> acp::Error {\n    acp::Error::new(\n        acp::ErrorCode::MethodNotFound.into(),\n        format!(\"{context} does not handle WaitForTerminalExit\"),\n    )\n}\n\n/// Initial auth mode hint from the agent's auth method metadata.\n///\n/// Determined at startup from `AuthMethod.meta.external_provider`.\n/// Used by the welcome screen to decide whether to show a browser-opening message or a manual token paste input.\n#[derive(Debug, Clone, Copy, PartialEq, Eq)]\npub enum AuthStartMode {\n    /// Mode not yet known (will be resolved after AuthenticateRequest).\n    Pending,\n    /// External provider (meta.external_provider == true); the browser opens automatically.\n    Command,\n}\n\n/// Result of connecting to an agent.","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/acp/mod.rs#L29-L65","documentation":"wait_for_exit_not_supported builds a JSON-RPC METHOD_NOT_FOUND (-32601) acp::Error stating that the given context (interactive pager or headless mode) does not handle the WaitForTerminalExit ACP method. It is centralized so code and message format stay consistent; callers (the adapter) fall back to polling for exit instead.","triggerScenarios":"An ACP client sending the `waitForTerminalExit` extension/method request to the pager adapter while running in either interactive pager or headless mode.","commonSituations":"Newer ACP clients assuming WaitForTerminalExit support; version mismatch between client expectations and this adapter's implemented method set.","solutions":["Use the adapter's polling fallback to detect terminal exit instead of calling the method","Upgrade the pager component if a version with WaitForTerminalExit support exists","Handle the -32601 response in the client and fall back to polling automatically","Suppress/feature-gate the call when the negotiated ACP capabilities omit the method"],"exampleFix":"// before\nlet exit = acp.waitForTerminalExit(sessionId)?; // -32601\n// after\nlet exit = match acp.waitForTerminalExit(sessionId) {\n    Err(e) if e.code == -32601 => pollForTerminalExit(sessionId),\n    other => other?,\n};","handlingStrategy":"fallback","validationCode":"// check the method is supported before calling\nif !acp.supports_method(\"waitForTerminalExit\") {\n    let exit = poll_for_terminal_exit(session_id)?;\n}","typeGuard":null,"tryCatchPattern":"match acp.call(\"waitForTerminalExit\", params) {\n    Err(err) if err.code == -32601 => poll_for_terminal_exit(session_id),\n    other => other,\n}","preventionTips":["Gate the call on negotiated ACP capabilities","Always implement a polling fallback for terminal exit detection","Keep client method expectations in sync with the adapter version","Treat -32601 as a capability signal, not a hard failure"],"tags":["acp","json-rpc","method-not-found","pager"],"backgroundTag":"rpc-method-not-found","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}