{"record":{"id":"e3342e97493830e5","repo":"xai-org/grok-build","slug":"source-path-is-not-a-valid-git-repository-or-workt","errorCode":null,"errorMessage":"Source path is not a valid git repository or worktree: {}","messagePattern":"Source path is not a valid git repository or worktree: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-grok-workspace/src/worktree/mod.rs","lineNumber":1656,"sourceCode":"    let dir_name = derive_worktree_label(label);\n    let dir_name = resolve_label_collision(&base, &dir_name);\n    Ok(base.join(dir_name).to_string_lossy().into_owned())\n}\n\n/// Prepare for creating a worktree from another worktree (fork flow).\n/// Returns the prepared result with sync response and whether to spawn an async task.\npub async fn prepare_worktree_from_worktree(\n    req: &CreateWorktreeFromWorktreeRequest,\n) -> PrepareWorktreeResult {\n    let source_path = Path::new(&req.source_worktree_path);\n\n    if git_cli(source_path, &[\"rev-parse\", \"--git-dir\"])\n        .await\n        .is_err()\n    {\n        return PrepareWorktreeResult {\n            response: Err(anyhow::anyhow!(\n                \"Source path is not a valid git repository or worktree: {}\",\n                req.source_worktree_path\n            )),\n            spawn_task: false,\n        };\n    }\n\n    let worktree_path =\n        match resolve_fork_worktree_path(source_path, &req.new_session_id, req.label.as_deref()) {\n            Ok(path) => path,\n            Err(e) => {\n                return PrepareWorktreeResult {\n                    response: Err(anyhow::anyhow!(\"Failed to resolve worktree path: {}\", e)),\n                    spawn_task: false,\n                };\n            }\n        };\n\n    let git_root_str = find_git_root_from_path(source_path)","sourceCodeStart":1638,"sourceCodeEnd":1674,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-grok-workspace/src/worktree/mod.rs#L1638-L1674","documentation":"Error \"Source path is not a valid git repository or worktree: {}\" thrown in xai-org/grok-build.","triggerScenarios":"Thrown at crates/codegen/xai-grok-workspace/src/worktree/mod.rs:1656 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}