{"record":{"id":"1681843b78adc0e9","repo":"facebook/flow","slug":"failed-to-query-mergebase","errorCode":null,"errorMessage":"Failed to query mergebase: {}","messagePattern":"Failed to query mergebase: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"rust_port/crates/flow_watchman/src/lib.rs","lineNumber":1298,"sourceCode":"    }\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 {:?}\",\n                            mergebase\n                        );\n                    }","sourceCodeStart":1280,"sourceCodeEnd":1316,"githubUrl":"https://github.com/facebook/flow/blob/f88ac94bcf6992f5d5a158854d94613ebb92c6e6/rust_port/crates/flow_watchman/src/lib.rs#L1280-L1316","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","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."],"exampleFix":"# before: mergebase_with points at a deleted branch\n# panic: Failed to query mergebase: unknown revision 'refs/heads/old-base'\n\n# after: fetch and point at a ref that exists\ngit fetch origin\ngit -C . merge-base HEAD origin/main   # verify, then set mergebase_with=origin/main","handlingStrategy":"validation","validationCode":"# before enabling mergebase tracking, prove the ref resolves\nVCS=\"git\"   # or sapling/hg to match your setup\n$VCS -C \"$WATCH_ROOT\" merge-base HEAD \"$MERGEBASE_WITH\" >/dev/null 2>&1 || {\n  echo \"mergebase_with ref '$MERGEBASE_WITH' does not resolve at $WATCH_ROOT\" >&2\n  exit 1\n}","typeGuard":"# 0 only when the configured base ref resolves locally\nmergebase_resolves() {\n  git -C \"$1\" merge-base HEAD \"$2\" >/dev/null 2>&1\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["watchman","vcs","git","mergebase","configuration","file-watcher"],"backgroundTag":"mergebase-query-failed","analyzedSha":"f88ac94bcf6992f5d5a158854d94613ebb92c6e6","analyzedAt":"2026-08-20T10:41:37.992Z","schemaVersion":2},"datasetVersion":"2026-08-23T11:17:13.642Z"}