xai-org/grok-build · info · acp::Error
-32601
-32601
Error message
{context} does not handle WaitForTerminalExit What it means
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.
Source
Thrown at crates/codegen/xai-grok-pager/src/acp/mod.rs:47
use anyhow::Result;
use tokio_util::sync::CancellationToken;
use crate::client_identity::{HEADLESS_CLIENT_TYPE, PAGER_CLIENT_TYPE, PAGER_CLIENT_VERSION};
use agent_client_protocol as acp;
use xai_acp_lib::{AcpAgentTx, AcpClientRx, acp_send};
use xai_grok_shell::agent::auth_method::AuthMethodKind;
use xai_grok_shell::agent::config::Config as AgentConfig;
use xai_grok_shell::sampling::types::ReasoningEffort;
pub use model_state::ModelState;
/// Construct a `METHOD_NOT_FOUND` error for `WaitForTerminalExit`.
///
/// Both the interactive pager and headless mode reject this ACP method (the adapter falls back to polling).
/// Centralised here so the error code and message format stay in sync.
pub(crate) fn wait_for_exit_not_supported(context: &str) -> acp::Error {
acp::Error::new(
acp::ErrorCode::MethodNotFound.into(),
format!("{context} does not handle WaitForTerminalExit"),
)
}
/// Initial auth mode hint from the agent's auth method metadata.
///
/// Determined at startup from `AuthMethod.meta.external_provider`.
/// Used by the welcome screen to decide whether to show a browser-opening message or a manual token paste input.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AuthStartMode {
/// Mode not yet known (will be resolved after AuthenticateRequest).
Pending,
/// External provider (meta.external_provider == true); the browser opens automatically.
Command,
}
/// Result of connecting to an agent.View on GitHub (pinned to bc7f02eddd)
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
Example fix
// before
let exit = acp.waitForTerminalExit(sessionId)?; // -32601
// after
let exit = match acp.waitForTerminalExit(sessionId) {
Err(e) if e.code == -32601 => pollForTerminalExit(sessionId),
other => other?,
}; Defensive patterns
Strategy: fallback
Validate before calling
// check the method is supported before calling
if !acp.supports_method("waitForTerminalExit") {
let exit = poll_for_terminal_exit(session_id)?;
} Try / catch
match acp.call("waitForTerminalExit", params) {
Err(err) if err.code == -32601 => poll_for_terminal_exit(session_id),
other => other,
} Prevention
- 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
When it happens
Trigger: An ACP client sending the `waitForTerminalExit` extension/method request to the pager adapter while running in either interactive pager or headless mode.
Common situations: Newer ACP clients assuming WaitForTerminalExit support; version mismatch between client expectations and this adapter's implemented method set.
Related errors
AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31).
Data as JSON: /api/errors/a975f5838ea5c078.
Report an issue: GitHub.