{"record":{"id":"eb6439b32c0e6e6c","repo":"xai-org/grok-build","slug":"acp-error-err","errorCode":null,"errorMessage":"ACP error: {err}","messagePattern":"ACP error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/worktree_cmd/mod.rs","lineNumber":146,"sourceCode":"#[derive(serde::Deserialize)]\nstruct ExtEnvelope<T> {\n    result: Option<T>,\n    error: Option<serde_json::Value>,\n}\nasync fn ext_call<T: serde::de::DeserializeOwned>(\n    tx: &xai_acp_lib::AcpAgentTx,\n    method: &str,\n    params: &impl serde::Serialize,\n) -> Result<T> {\n    let req =\n        ext_request(method, params).map_err(|e| anyhow::anyhow!(\"failed to build request: {e}\"))?;\n    let resp = acp_send(req, tx)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"{e}\"))?;\n    let envelope: ExtEnvelope<T> = serde_json::from_str(resp.0.get())\n        .map_err(|e| anyhow::anyhow!(\"response parse error: {e}\"))?;\n    if let Some(err) = envelope.error {\n        bail!(\"ACP error: {err}\");\n    }\n    envelope\n        .result\n        .ok_or_else(|| anyhow::anyhow!(\"ACP response missing result field\"))\n}\nasync fn cmd_list(\n    tx: &xai_acp_lib::AcpAgentTx,\n    repo: Option<String>,\n    types: Vec<String>,\n    json: bool,\n    all: bool,\n) -> Result<()> {\n    let records: Vec<WorktreeRecord> = ext_call(\n        tx,\n        \"x.ai/git/worktree/list\",\n        &serde_json::json!({\n            \"repo\": repo,\n            \"type\": types,","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/worktree_cmd/mod.rs#L128-L164","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the `{err}` detail in the message — it carries the actual server-side cause.","Verify the ACP/agent server is running and matches the CLI version.","Retry the specific worktree subcommand after resolving the server-side condition (e.g. refresh `worktree list` to get valid ids)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match worktree_list() {\n    Err(e) if e.to_string().starts_with(\"ACP error:\") => {\n        eprintln!(\"ACP server rejected request: {e}; check server health/version\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => use(v),\n}","preventionTips":["Ensure the ACP server is running and version-matched to the CLI.","Refresh `worktree list` before operating on ids.","Include the `{err}` detail in bug reports — it names the server-side cause."],"tags":["acp","rpc","worktree"],"backgroundTag":"rpc-error-response","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}