xai-org/grok-build · error

ACP error: {err}

Error message

ACP error: {err}

What it means

The worktree command's ext_call helper sends an ACP (agent control protocol) extension request and converts any error envelope returned by the server into an anyhow error. It is shared by cmd_list, cmd_show, cmd_rm, cmd_gc, and cmd_db, so any server-side rejection of those worktree operations surfaces as this message with the server's error text appended.

Source

Thrown at crates/codegen/xai-grok-pager/src/worktree_cmd/mod.rs:146

#[derive(serde::Deserialize)]
struct ExtEnvelope<T> {
    result: Option<T>,
    error: Option<serde_json::Value>,
}
async fn ext_call<T: serde::de::DeserializeOwned>(
    tx: &xai_acp_lib::AcpAgentTx,
    method: &str,
    params: &impl serde::Serialize,
) -> Result<T> {
    let req =
        ext_request(method, params).map_err(|e| anyhow::anyhow!("failed to build request: {e}"))?;
    let resp = acp_send(req, tx)
        .await
        .map_err(|e| anyhow::anyhow!("{e}"))?;
    let envelope: ExtEnvelope<T> = serde_json::from_str(resp.0.get())
        .map_err(|e| anyhow::anyhow!("response parse error: {e}"))?;
    if let Some(err) = envelope.error {
        bail!("ACP error: {err}");
    }
    envelope
        .result
        .ok_or_else(|| anyhow::anyhow!("ACP response missing result field"))
}
async fn cmd_list(
    tx: &xai_acp_lib::AcpAgentTx,
    repo: Option<String>,
    types: Vec<String>,
    json: bool,
    all: bool,
) -> Result<()> {
    let records: Vec<WorktreeRecord> = ext_call(
        tx,
        "x.ai/git/worktree/list",
        &serde_json::json!({
            "repo": repo,
            "type": types,

View on GitHub (pinned to bc7f02eddd)

Solutions

  1. Read the `{err}` detail in the message — it carries the actual server-side cause.
  2. Verify the ACP/agent server is running and matches the CLI version.
  3. Retry the specific worktree subcommand after resolving the server-side condition (e.g. refresh `worktree list` to get valid ids).
Defensive patterns

Strategy: try-catch

Try / catch

match worktree_list() {
    Err(e) if e.to_string().starts_with("ACP error:") => {
        eprintln!("ACP server rejected request: {e}; check server health/version");
    }
    Err(e) => return Err(e),
    Ok(v) => use(v),
}

Prevention

When it happens

Trigger: Any of cmd_list/cmd_show/cmd_rm/cmd_gc/cmd_db issuing an ext_call whose response envelope contains an `error` field — e.g. the ACP server rejects the request, is in a bad state, or the operation fails server-side.

Common situations: ACP server not running properly or wrong version; stale worktree ids passed to rm/show/gc; server-side db errors during cmd_db; concurrent modification of worktrees.

Related errors


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