xai-org/grok-build · error · ToolError

Failed to reach the client for user question: {msg}

Error message

Failed to reach the client for user question: {msg}

What it means

When the client answers the user question, its reply travels back through the transport layer. `UserQuestionError::TransportError(msg)` means the reply could not be delivered or fetched at the transport level, so the tool surfaces it as an execution error prefixed with 'Failed to reach the client for user question'. This indicates a communication problem with the client, not a bad answer payload.

Source

Thrown at crates/codegen/xai-grok-tools/src/implementations/grok_build/ask_user_question/mod.rs:521

                questions,
                partial_answers,
            }) => {
                let message = format::format_chat_about_this(&questions, &partial_answers);
                Ok(AskUserQuestionOutput::UserAnswered { message })
            }
            Ok(UserQuestionResponse::SkipInterview {
                questions,
                partial_answers,
            }) => {
                let message = format::format_skip_interview(&questions, &partial_answers);
                Ok(AskUserQuestionOutput::UserAnswered { message })
            }
            Ok(UserQuestionResponse::Cancelled) => Ok(AskUserQuestionOutput::UserAnswered {
                message: unanswered.to_string(),
            }),
            Err(UserQuestionError::TransportError(msg)) => {
                Err(xai_tool_runtime::ToolError::execution(
                    xai_tool_protocol::ToolId::new("ask_user_question").expect("valid"),
                    format!("Failed to reach the client for user question: {msg}"),
                ))
            }
            Err(UserQuestionError::MalformedResponse(msg)) => {
                Err(xai_tool_runtime::ToolError::execution(
                    xai_tool_protocol::ToolId::new("ask_user_question").expect("valid"),
                    format!("Client returned an invalid response to user question: {msg}"),
                ))
            }
        }
    }
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::types::resources::Resources;
    use crate::types::tool_metadata::test_ctx_with_call_id;

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Inspect the embedded `{msg}` detail to identify the underlying transport failure (connection reset, write error, unsupported method).
  2. Re-establish the client connection (reconnect ACP session) and retry the tool call.
  3. Check that the client version supports the user-question ACP extension; upgrade the client/extension if not.
  4. If networks are unstable, increase keep-alives/timeouts on the transport or reduce question round-trips by batching questions in one call.

Example fix

// before: relying on a possibly stale connection
await tool("ask_user_question", { questions });
// after: ensure the connection is healthy first
if (!await session.ping()) { await session.reconnect(); }
await tool("ask_user_question", { questions });
Defensive patterns

Strategy: retry

Validate before calling

// verify connectivity before the round-trip
const alive = await session.ping();
if (!alive) throw new Error("client unreachable; reconnect before asking questions");

Try / catch

try {
  const out = await tool("ask_user_question", { questions });
} catch (e) {
  if (String(e.message).startsWith("Failed to reach the client")) {
    await backoffRetry(() => tool("ask_user_question", { questions }), 3);
  } else { throw e; }
}

Prevention

When it happens

Trigger: The ACP connection used to deliver the questionnaire or fetch its reply failed — e.g. sending the request over the transport errored, the reply read failed mid-transfer, or the peer connection was reset while the question was outstanding.

Common situations: Flaky or dropped connection between agent host and editor client; proxy/firewall terminating long-lived websocket/stdio sessions; client busy-restart while a question is in flight; version mismatch where the client lacks the user-question extension method.

Related errors


AI-assisted analysis of xai-org/grok-build@bc7f02eddd (2026-08-31). Data as JSON: /api/errors/53d542a53d55fd7d. Report an issue: GitHub.