facebook/flow · error · Error
Flow check failed!
Error message
Flow check failed!
What it means
flow-dev-tools runs `<bin> full-check --json --flowconfig-name <name> <root>` and treats exit code 0 (clean) and 2 (errors reported as JSON) as success. Any other exit code — crash, internal error, binary missing, OOM kill — throws 'Flow check failed!' with the process error, stdout, and stderr attached for diagnosis.
Solutions
- Copy the failing command from the error output (bin full-check --json ...) and run it manually to see the real stderr.
- Check the installed flow version matches what the .flowconfig and repo expect; upgrade/downgrade flow-bin consistently.
- Run `flow stop` (or delete .flowconfig-magic) to clear a stale daemon, then retry.
- Verify the bin path exists and is executable (which flow; npm ls flow-bin).
- If OOM, raise available memory or scope the check to fewer files.
Defensive patterns
Strategy: try-catch
Validate before calling
// Verify the flow binary runs before asking it for errors
const {execFileSync} = require('child_process');
function flowBinaryWorks(bin) {
try { execFileSync(bin, ['version'], {stdio: 'ignore'}); return true; }
catch { return false; }
} Try / catch
try {
const errors = await getFlowErrors(bin, 'full-check', root, '.flowconfig');
} catch (e) {
if (e.message.startsWith('Flow check failed!')) {
// err/stdout/stderr are embedded — extract and surface them, then fail the step
console.error(e.message);
throw new Error('flow exited abnormally — run the printed command manually to diagnose');
}
throw e;
} Prevention
- Pin flow-bin and run `flow version` as a CI smoke step before full-check.
- Keep .flowconfig options compatible with the installed flow version; check the changelog on upgrades.
- After upgrading flow, run `flow stop` to clear daemons before CI checks.
When it happens
Trigger: getFlowErrors with a flow binary that exits nonzero other than 2: flow internal error (exit 1), binary not found (spawn ENOENT), server crash or SIGABRT/SIGKILL (OOM), or a .flowconfig option the installed flow version rejects at startup.
Common situations: CI scripts or dist-tooling invoking getFlowErrors after a flow upgrade that changed flowconfig semantics; flow daemon corrupted after a version switch (needs flow stop / server cleanup); system OOM on huge repos; flow not installed at the configured bin path.
Related errors
- Attempted to insert a statement into
- Cannot insert array into non-array parent type
- Cannot perform a remove mutation on node of type
- CommonJS exports cannot be combined with ES module exports.
- Could not find target in array of
AI-assisted analysis of facebook/flow@f88ac94bcf (2026-08-20).
Data as JSON: /api/errors/0961d7fd3ef41adb.
Report an issue: GitHub.
Appendix: 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 f88ac94bcf)