facebook/flow · error · Error

Failed to find anything starting with ${dirPrefix} in ${flow

Error message

Failed to find anything starting with ${dirPrefix} in ${flowBinModulePath}

What it means

After confirming the platform prefix (e.g. flow-linux64-v), the extension lists the flow-bin module directory and searches for an entry starting with that prefix. If none is found it throws, naming the prefix and module path — the installed flow-bin package has no binary directory for this platform.

Source

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

          ? '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}`);
  }
  return { flowBinDirName, flowBinName };
}

async function getShasums(
  flowBinModulePath: string,
  logger: Logger,
): Promise<Buffer> {
  const extensionPath = getExtensionPath();
  try {

View on GitHub (pinned to d1341dac89)

Solutions

  1. Force a clean reinstall: remove node_modules/flow-bin and `npm install flow-bin@<same-version>`
  2. If dirs are still missing, clear the npm cache (`npm cache clean --force`) and reinstall; verify contents with `npm pack flow-bin`
  3. Inspect the directory named in the error — if the platform dir has a different name, update flow-bin or file an issue
Defensive patterns

Strategy: validation

Validate before calling

import {readdir} from 'fs/promises';

async function hasPlatformDir(
  flowBinModulePath: string,
  dirPrefix: string,
): Promise<boolean> {
  const entries = await readdir(flowBinModulePath).catch(() => [] as string[]);
  return entries.some((e) => e.startsWith(dirPrefix));
}

Try / catch

try {
  const {flowBinDirName, flowBinName} = await getFlowBinRelativePath(p);
} catch (err) {
  if (/Failed to find anything starting with/.test(err.message)) {
    // treat as corrupt install: prompt reinstall of flow-bin
  } else throw err;
}

Prevention

When it happens

Trigger: A corrupted or partial flow-bin install (platform dirs missing), an npm cache fault, a manually pruned package, or a mismatch where the package ships differently-named platform dirs than the prefix expects.

Common situations: Interrupted npm install; npm cache corruption; flow-bin versions with renamed platform directories; antivirus or disk-space issues during extraction.

Related errors


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