facebook/flow · critical
Failed to query mergebase: {}
Error message
Failed to query mergebase: {} What it means
The same Watchman mergebase check, but the VCS was found and the query itself failed: ErrorStatus::Errored(msg) carries the VCS command's failure, and the panic reproduces that message verbatim. Typical payloads are an unknown revision/ref, a corrupt repository, or an auth/hook failure in the daemon's non-interactive environment.
Source
Thrown at rust_port/crates/flow_watchman/src/lib.rs:1298
}
}
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 {:?}",
mergebase
);
}View on GitHub (pinned to f88ac94bcf)
Solutions
- Reproduce manually: git -C <root> merge-base HEAD <mergebase_with> — its stderr is the text inside the panic; fix what it names.
- Fix the ref: git fetch the remote, point mergebase_with at an existing branch, or create the missing ref.
- If the repo is corrupt, run git fsck and re-clone if needed.
- Restart the watcher/server after the fix; the panic already killed the watch loop.
Example fix
# before: mergebase_with points at a deleted branch # panic: Failed to query mergebase: unknown revision 'refs/heads/old-base' # after: fetch and point at a ref that exists git fetch origin git -C . merge-base HEAD origin/main # verify, then set mergebase_with=origin/main
Defensive patterns
Strategy: validation
Validate before calling
# before enabling mergebase tracking, prove the ref resolves
VCS="git" # or sapling/hg to match your setup
$VCS -C "$WATCH_ROOT" merge-base HEAD "$MERGEBASE_WITH" >/dev/null 2>&1 || {
echo "mergebase_with ref '$MERGEBASE_WITH' does not resolve at $WATCH_ROOT" >&2
exit 1
} Type guard
# 0 only when the configured base ref resolves locally
mergebase_resolves() {
git -C "$1" merge-base HEAD "$2" >/dev/null 2>&1
} Prevention
- git fetch the base ref before starting the watcher; shallow checkouts need the ref's history.
- Re-validate mergebase_with whenever branches are deleted or renamed.
- Prefer remote-tracking refs (origin/main) over local branch names that get deleted.
- Run git fsck periodically; corrupt repos surface here as Errored(msg) panics.
When it happens
Trigger: The configured mergebase_with ref does not resolve in the local repo (deleted branch, typo, shallow/trimmed CI checkout, never-fetched upstream ref), the repository is corrupt (interrupted repack/gc), or a VCS hook/prompt fails when the daemon runs `merge-base` — the panic message contains the underlying error.
Common situations: See trigger scenarios.
Related errors
- Failed to query mergebase: unable to find vcs
- $FLOW_STACK_SIZE must be a number, got {s}
- workers required for init
- workers required for recheck
- max_workers should be positive
AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20).
Data as JSON: /api/errors/1681843b78adc0e9.
Report an issue: GitHub.