{"record":{"id":"a38114a1a711e8c2","repo":"xai-org/grok-build","slug":"worktree-not-found-id-or-path","errorCode":null,"errorMessage":"worktree not found: {id_or_path}","messagePattern":"worktree not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-pager/src/worktree_cmd/mod.rs","lineNumber":189,"sourceCode":"        display::print_json(&records, &mut out)\n    } else {\n        display::print_table(&records, &mut out)\n    };\n    Ok(crate::util::ignore_broken_pipe(written)?)\n}\nasync fn cmd_show(tx: &xai_acp_lib::AcpAgentTx, id_or_path: &str) -> Result<()> {\n    let rec: Option<WorktreeRecord> = ext_call(\n        tx,\n        \"x.ai/git/worktree/show\",\n        &serde_json::json!({ \"idOrPath\" : id_or_path }),\n    )\n    .await?;\n    match rec {\n        Some(r) => {\n            let written = display::print_show(&r, &mut std::io::stdout().lock());\n            Ok(crate::util::ignore_broken_pipe(written)?)\n        }\n        None => bail!(\"worktree not found: {id_or_path}\"),\n    }\n}\n#[derive(serde::Deserialize)]\n#[serde(rename_all = \"camelCase\")]\nstruct RemoveResponse {\n    removed: bool,\n    #[serde(default)]\n    resolved_path: Option<String>,\n}\nasync fn cmd_rm(\n    tx: &xai_acp_lib::AcpAgentTx,\n    ids: Vec<String>,\n    force: bool,\n    dry_run: bool,\n) -> Result<()> {\n    for id_or_path in &ids {\n        let resp: Result<RemoveResponse> = ext_call(\n            tx,","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-pager/src/worktree_cmd/mod.rs#L171-L207","documentation":"cmd_show resolves a worktree by id or path; if the lookup returns no record, it bails with `worktree not found: {id_or_path}`. The record may have been removed or never existed — the identifier supplied by the user matched nothing in the worktree store.","triggerScenarios":"Running `grok worktree show <id_or_path>` where the id or path does not correspond to any existing worktree record in the store.","commonSituations":"Worktree already removed (manually or by gc); typo in the id; passing a relative path when the store keys by absolute path; stale ids cached in scripts.","solutions":["Run `grok worktree list` to see valid ids/paths and re-run show with one of them.","Use the exact absolute path if addressing by path.","If it was garbage-collected, recreate the worktree instead of showing it."],"exampleFix":"// before\ngrok worktree show wt_abc123   # stale id\n// after\ngrok worktree list\ngrok worktree show wt_def456","handlingStrategy":"validation","validationCode":"fn worktree_exists(id_or_path: &str) -> bool {\n    worktree_list()\n        .map(|list| {\n            list.iter().any(|w| {\n                w.id == id_or_path\n                    || std::path::Path::new(&w.path).canonicalize().ok()\n                        == std::path::Path::new(id_or_path).canonicalize().ok()\n            })\n        })\n        .unwrap_or(false)\n}\nif !worktree_exists(id) { eprintln!(\"unknown worktree: {id}\"); return; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always obtain ids from `grok worktree list`, not from memory or old scripts.","Use absolute canonical paths when addressing worktrees by path.","Account for gc: recent garbage collection may have removed the worktree."],"tags":["cli","not-found","worktree"],"backgroundTag":"resource-not-found","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}