{"record":{"id":"0ecc196c51045982","repo":"facebook/flow","slug":"failed-to-query-mergebase-unable-to-find-vcs","errorCode":null,"errorMessage":"Failed to query mergebase: unable to find vcs","messagePattern":"Failed to query mergebase: unable to find vcs","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust_port/crates/flow_watchman/src/lib.rs","lineNumber":1295,"sourceCode":"        .await\n    } else {\n        Ok(None)\n    }\n}\n\nasync fn check_for_changed_mergebase(env: &mut Env) -> Option<bool> {\n    match env.mergebase.clone() {\n        None => {\n            flow_hh_logger::debug!(\n                \"Unable to check for changed mergebase: unknown previous mergebase\"\n            );\n            None\n        }\n        Some(old_mergebase) => {\n            let new_mergebase = match get_mergebase(env).await {\n                Ok(mergebase) => mergebase,\n                Err(vcs_utils::ErrorStatus::NotInstalled { .. }) => {\n                    panic!(\"Failed to query mergebase: unable to find vcs\");\n                }\n                Err(vcs_utils::ErrorStatus::Errored(msg)) => {\n                    panic!(\"Failed to query mergebase: {}\", msg);\n                }\n            };\n            match new_mergebase {\n                Some(mergebase) => {\n                    let changed_mergebase = mergebase != old_mergebase;\n                    if changed_mergebase {\n                        flow_hh_logger::info!(\n                            \"Watchman reports mergebase changed from {:?} to {:?}\",\n                            old_mergebase,\n                            mergebase\n                        );\n                        env.mergebase = Some(mergebase);\n                    } else {\n                        flow_hh_logger::debug!(\n                            \"Watchman reports mergebase is unchanged at {:?}\",","sourceCodeStart":1277,"sourceCodeEnd":1313,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_watchman/src/lib.rs#L1277-L1313","documentation":"When mergebase tracking is enabled, the Watchman-based file watcher queries the VCS for the current merge-base of the watch root so it can re-check only files changed since the baseline. check_for_changed_mergebase() panics on ErrorStatus::NotInstalled — no usable VCS (git/hg/sapling) found for the repository — because incremental checking without a mergebase baseline would be unsound.","triggerScenarios":"Enabling mergebase tracking (the watcher's mergebase_with setting) for a watch root that is not a git/hg/sapling checkout, or where the VCS binary is missing from the daemon's PATH; the panic fires on a later check, once a previous mergebase has been recorded and the watcher re-queries it.","commonSituations":"Source trees copied out of a repo without .git; minimal containers lacking git; daemons started by launchd/systemd with a stripped PATH; the VCS being uninstalled or moved after the server started; roots nested below the actual repo root.","solutions":["Install the VCS (git or sapling/hg) and ensure it is on the daemon's PATH — verify with git -C <root> rev-parse HEAD run as the daemon user.","Run Flow from a real checkout, with the root at or below the repo root.","If the directory is intentionally not a checkout, disable mergebase tracking in the watcher settings so the non-mergebase code path is used.","Restart the file watcher/server afterwards — the panic tears down the watch loop."],"exampleFix":"# before: mergebase tracking enabled in a tree without .git\nflow daemon start  # later: panic: Failed to query mergebase: unable to find vcs\n\n# after: run from a real checkout\ngit -C /repo rev-parse HEAD  # works\nflow daemon start --root /repo","handlingStrategy":"validation","validationCode":"# before enabling mergebase tracking for a root\ngit -C \"$WATCH_ROOT\" rev-parse --git-dir >/dev/null 2>&1 || {\n  echo \"no usable VCS at $WATCH_ROOT - do not enable mergebase tracking\" >&2\n  exit 1\n}","typeGuard":"# returns 0 only when the root has a working VCS the daemon can call\nvcs_usable() { git -C \"$1\" rev-parse HEAD >/dev/null 2>&1; }","tryCatchPattern":null,"preventionTips":["Run the daemon under the same PATH your shell has; launchd/systemd units need explicit PATH for git.","Verify the watch root is inside a real checkout before enabling mergebase tracking.","Include the VCS binary in container images for flow daemons.","Alert when the VCS disappears from the environment (uninstalls, image slimming)."],"tags":["watchman","vcs","git","environment","file-watcher","mergebase"],"backgroundTag":"vcs-not-found","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}