facebook/flow · critical
Failed to query mergebase: unable to find vcs
Error message
Failed to query mergebase: unable to find vcs
What it means
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.
Source
Thrown at rust_port/crates/flow_watchman/src/lib.rs:1295
.await
} else {
Ok(None)
}
}
async fn check_for_changed_mergebase(env: &mut Env) -> Option<bool> {
match env.mergebase.clone() {
None => {
flow_hh_logger::debug!(
"Unable to check for changed mergebase: unknown previous mergebase"
);
None
}
Some(old_mergebase) => {
let new_mergebase = match get_mergebase(env).await {
Ok(mergebase) => mergebase,
Err(vcs_utils::ErrorStatus::NotInstalled { .. }) => {
panic!("Failed to query mergebase: unable to find vcs");
}
Err(vcs_utils::ErrorStatus::Errored(msg)) => {
panic!("Failed to query mergebase: {}", msg);
}
};
match new_mergebase {
Some(mergebase) => {
let changed_mergebase = mergebase != old_mergebase;
if changed_mergebase {
flow_hh_logger::info!(
"Watchman reports mergebase changed from {:?} to {:?}",
old_mergebase,
mergebase
);
env.mergebase = Some(mergebase);
} else {
flow_hh_logger::debug!(
"Watchman reports mergebase is unchanged at {:?}",View on GitHub (pinned to f88ac94bcf)
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.
Example fix
# before: mergebase tracking enabled in a tree without .git flow daemon start # later: panic: Failed to query mergebase: unable to find vcs # after: run from a real checkout git -C /repo rev-parse HEAD # works flow daemon start --root /repo
Defensive patterns
Strategy: validation
Validate before calling
# before enabling mergebase tracking for a root
git -C "$WATCH_ROOT" rev-parse --git-dir >/dev/null 2>&1 || {
echo "no usable VCS at $WATCH_ROOT - do not enable mergebase tracking" >&2
exit 1
} Type guard
# returns 0 only when the root has a working VCS the daemon can call
vcs_usable() { git -C "$1" rev-parse HEAD >/dev/null 2>&1; } Prevention
- 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).
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Failed to query mergebase: {}
- flow-dot-js wasm requires crypto.getRandomValues
- Unable to determine executable path: {}
- failed to read executable at {} for flow build id: {}
- failed to get current directory
AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20).
Data as JSON: /api/errors/0ecc196c51045982.
Report an issue: GitHub.