facebook/flow · error · Error

Failed to determine correct binary for platform ${process.pl

Error message

Failed to determine correct binary for platform ${process.platform} and arch ${process.arch}

What it means

getFlowBinDirPrefixForPlatform maps platform/arch to the directory prefix flow-bin ships (flow-linux64-v*, flow-osx-v*, flow-win64-v*; osx x64/arm64, linux x64, win32 x64 only). For any other combination it returns null and getFlowBinRelativePath throws with the detected platform and arch.

Source

Thrown at packages/flow-for-vscode/src/utils/getVerifiedFlowBinPath.ts:38

function getFlowBinDirPrefixForPlatform(): null | string {
  return process.platform === 'darwin' && process.arch === 'arm64'
    ? 'flow-osx-arm64-v'
    : process.platform === 'darwin' && process.arch === 'x64'
      ? 'flow-osx-v'
      : process.platform === 'linux' && process.arch === 'x64'
        ? 'flow-linux64-v'
        : process.platform === 'win32' && process.arch === 'x64'
          ? 'flow-win64-v'
          : null;
}

async function getFlowBinRelativePath(
  flowBinModulePath: string,
): Promise<{ flowBinDirName: string; flowBinName: string }> {
  const dirPrefix = getFlowBinDirPrefixForPlatform();
  if (!dirPrefix) {
    throw new Error(
      `Failed to determine correct binary for platform ${process.platform} and arch ${process.arch}`,
    );
  }
  const flowBinModuleContents = await readdir(flowBinModulePath);
  const flowBinDirName = flowBinModuleContents.find((x) =>
    x.startsWith(dirPrefix),
  );
  if (!flowBinDirName) {
    throw new Error(
      `Failed to find anything starting with ${dirPrefix} in ${flowBinModulePath}`,
    );
  }
  const flowBinDir = path.join(flowBinModulePath, flowBinDirName);
  const flowBinDirContents = await readdir(flowBinDir);
  const flowBinName = flowBinDirContents.find((x) => x.startsWith('flow'));
  if (!flowBinName) {
    throw new Error(`Failed to find flow binary in ${flowBinDir}`);
  }

View on GitHub (pinned to d1341dac89)

Solutions

  1. Point `flow.pathToFlow` at a community/locally built flow binary for your platform to bypass bundled verification
  2. Run under an x64 emulator (Rosetta/qemu) as a workaround
  3. Check the flow repo for an open issue/PR covering your platform (linux-arm64 is a known gap)
Defensive patterns

Strategy: type-guard

Validate before calling

const SUPPORTED = new Set([
  'darwin_x64',
  'darwin_arm64',
  'linux_x64',
  'win32_x64',
]);

function bundledFlowSupported(): boolean {
  return SUPPORTED.has(`${process.platform}_${process.arch}`);
}

Type guard

function isSupportedPlatform(
  platform: NodeJS.Platform,
  arch: string,
): boolean {
  return (
    (platform === 'darwin' && (arch === 'x64' || arch === 'arm64')) ||
    (platform === 'linux' && arch === 'x64') ||
    (platform === 'win32' && arch === 'x64')
  );
}

Prevention

When it happens

Trigger: Running the bundled-flow verification path on an unmapped platform/arch, e.g. linux arm64, freebsd, or win32 ia32 — process.platform/process.arch have no prefix mapping.

Common situations: Linux ARM64 machines (Raspberry Pi, ARM CI runners, ARM Docker hosts); BSD/Solaris; 32-bit Windows; Rosetta quirks reporting unexpected arch values.

Related errors


AI-assisted analysis of facebook/flow@d1341dac89 (2026-08-17). Data as JSON: /api/errors/bda4bc4ea8a57742. Report an issue: GitHub.