facebook/flow · error · Error
Flow check failed!
Error message
Flow check failed!
What it means
flow-dev-tools runs the Flow binary (execManual) and treats exit code 0 (clean) and 2 (type errors reported) as success. Any other exit code — crash, bad usage, missing binary, signal death — causes 'Flow check failed!' to be thrown with the captured stdout/stderr.
Source
Thrown at packages/flow-dev-tools/src/errors.js:51
format(
'%s status --no-auto-start --json %s %s',
bin,
flowconfigNameFlag,
root,
),
};
const [err, stdout, stderr] = await execManual(cmd, {
cwd: root,
maxBuffer: Infinity,
});
// 0 - no errors
// 2 - Some errors
if (err == null || err.code === 2) {
return JSON.parse(stdout.toString());
}
throw new Error(format('Flow check failed!', err, stdout, stderr));
}
async function getFlowErrors(
bin: string,
errorCheckCommand: ErrorCheckCommand,
root: string,
flowconfigName: string,
): Promise<FlowResult> {
return getFlowErrorsImpl(bin, errorCheckCommand, root, flowconfigName);
}
function mainSourceLocOfError(error: FlowError): ?FlowLoc {
const {operation, message} = error;
for (const msg of [operation, ...message]) {
if (msg && msg.loc && msg.loc.type === 'SourceFile') {
return msg.loc;
}
}View on GitHub (pinned to d1341dac89)
Solutions
- Run the exact underlying command shown in the error output manually (e.g. `npx flow check --json --strip-root`) to see the real failure
- Verify flow-bin is installed and runnable: `npm ls flow-bin` and `npx flow version`
- Align versions: the number in .flowconfig's [version] section must match the installed flow-bin
- If flow crashed, stop the server (`npx flow stop`) and retry; give CI more memory
Defensive patterns
Strategy: try-catch
Validate before calling
import {execFileSync} from 'child_process';
function flowBinaryWorks(flowPath: string): boolean {
try {
const out = execFileSync(flowPath, ['version'], {encoding: 'utf8'});
return /Flow\s+v?\d/.test(out);
} catch {
return false;
}
} Try / catch
try {
const result = await getFlowErrors(bin, cmd, root, flowconfigName);
} catch (err) {
// the message embeds err/stdout/stderr: surface stderr to the user,
// distinguish 'command not found' vs flow diagnostics vs crash
throw new Error(`Flow invocation failed: ${err.message}`);
} Prevention
- Pin the exact flow-bin version matching .flowconfig in CI
- Add a `npx flow version` smoke step before dependent jobs
- Run `npx flow stop` when a server crash is suspected
- Keep errorCheckCommand flags valid for the installed flow version
When it happens
Trigger: The spawned flow command (e.g. `flow check --json` or a configured errorCheckCommand) exits with a code other than 0 or 2: flow-bin missing or not executable, a flow version incompatible with the repo's .flowconfig, a flow daemon crash or OOM, invalid flowconfig, or a custom errorCheckCommand that exits non-zero.
Common situations: Running flow-dev-tools scripts on machines without flow-bin installed; .flowconfig [version] header not matching the installed flow; a crashed flow server leaving stale state; CI containers lacking memory or native deps for flow.
Related errors
- Unexpected function parameter ${param.type}
- updatePendingStatements: Variable for dependency "${dep}" no
- updatePendingStatements: Variable parent of "${dep}" not fou
- Flow version ${version} doesn't support 'flow lsp'. Please u
- Unsupported .flowconfig option `log.file`. The VS Code exten
AI-assisted analysis of facebook/flow@d1341dac89 (2026-08-17).
Data as JSON: /api/errors/0961d7fd3ef41adb.
Report an issue: GitHub.