{"record":{"id":"3e6d9f98c7e8bb95","repo":"xai-org/grok-build","slug":"source-git-must-be-a-directory-not-a-linked-work","errorCode":null,"errorMessage":"source .git must be a directory (not a linked worktree .git file): {}","messagePattern":"source \\.git must be a directory \\(not a linked worktree \\.git file\\): (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-fast-worktree/src/copy/gitdir.rs","lineNumber":106,"sourceCode":"/// Like [`copy_git_dir`], but keep extra `refs/remotes/origin/*` names through\n/// CoW skip + post-copy sanitize so a later checkout can still see them.\npub(crate) fn copy_git_dir_keeping_origin(\n    source_git: &Path,\n    dest_git: &Path,\n    extra_origin: &HashSet<String>,\n) -> Result<GitDirCopyStats> {\n    copy_git_dir_with_workers(source_git, dest_git, num_cpus::get(), extra_origin)\n}\n\n/// `copy_git_dir` with an explicit worker cap, so tests can force the parallel\n/// branch (`max_workers >= 2`) deterministically regardless of `num_cpus`.\nfn copy_git_dir_with_workers(\n    source_git: &Path,\n    dest_git: &Path,\n    max_workers: usize,\n    extra_origin: &HashSet<String>,\n) -> Result<GitDirCopyStats> {\n    anyhow::ensure!(\n        source_git.is_dir(),\n        \"source .git must be a directory (not a linked worktree .git file): {}\",\n        source_git.display()\n    );\n\n    let files_copied = AtomicU64::new(0);\n    let dirs_created = AtomicU64::new(0);\n    let symlinks_copied = AtomicU64::new(0);\n    let entries_skipped = AtomicU64::new(0);\n\n    let filter = StandaloneCopyFilter::from_git_dir_keeping(source_git, extra_origin);\n\n    // First pass: collect work items for parallel copy.\n    // We collect all (source, dest) pairs, then process them in parallel.\n    let mut work_items: Vec<CopyWork> = Vec::new();\n    collect_work_recursive(\n        source_git,\n        dest_git,","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-fast-worktree/src/copy/gitdir.rs#L88-L124","documentation":"Error \"source .git must be a directory (not a linked worktree .git file): {}\" thrown in xai-org/grok-build.","triggerScenarios":"Thrown at crates/codegen/xai-fast-worktree/src/copy/gitdir.rs:106 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"}