{"record":{"id":"43375afee71e66de","repo":"facebook/flow","slug":"failed-to-find-anything-starting-with-dirprefix","errorCode":null,"errorMessage":"Failed to find anything starting with ${dirPrefix} in ${flowBinModulePath}","messagePattern":"Failed to find anything starting with (.+?) in (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/flow-for-vscode/src/utils/getVerifiedFlowBinPath.ts","lineNumber":47,"sourceCode":"          ? 'flow-win64-v'\n          : null;\n}\n\nasync function getFlowBinRelativePath(\n  flowBinModulePath: string,\n): Promise<{ flowBinDirName: string; flowBinName: string }> {\n  const dirPrefix = getFlowBinDirPrefixForPlatform();\n  if (!dirPrefix) {\n    throw new Error(\n      `Failed to determine correct binary for platform ${process.platform} and arch ${process.arch}`,\n    );\n  }\n  const flowBinModuleContents = await readdir(flowBinModulePath);\n  const flowBinDirName = flowBinModuleContents.find((x) =>\n    x.startsWith(dirPrefix),\n  );\n  if (!flowBinDirName) {\n    throw new Error(\n      `Failed to find anything starting with ${dirPrefix} in ${flowBinModulePath}`,\n    );\n  }\n  const flowBinDir = path.join(flowBinModulePath, flowBinDirName);\n  const flowBinDirContents = await readdir(flowBinDir);\n  const flowBinName = flowBinDirContents.find((x) => x.startsWith('flow'));\n  if (!flowBinName) {\n    throw new Error(`Failed to find flow binary in ${flowBinDir}`);\n  }\n  return { flowBinDirName, flowBinName };\n}\n\nasync function getShasums(\n  flowBinModulePath: string,\n  logger: Logger,\n): Promise<Buffer> {\n  const extensionPath = getExtensionPath();\n  try {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/facebook/flow/blob/d1341dac899a79c027762f6b423d896045287620/packages/flow-for-vscode/src/utils/getVerifiedFlowBinPath.ts#L29-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"Interrupted npm install; npm cache corruption; flow-bin versions with renamed platform directories; antivirus or disk-space issues during extraction.","solutions":["Force a clean reinstall: remove node_modules/flow-bin and `npm install flow-bin@<same-version>`","If dirs are still missing, clear the npm cache (`npm cache clean --force`) and reinstall; verify contents with `npm pack flow-bin`","Inspect the directory named in the error — if the platform dir has a different name, update flow-bin or file an issue"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import {readdir} from 'fs/promises';\n\nasync function hasPlatformDir(\n  flowBinModulePath: string,\n  dirPrefix: string,\n): Promise<boolean> {\n  const entries = await readdir(flowBinModulePath).catch(() => [] as string[]);\n  return entries.some((e) => e.startsWith(dirPrefix));\n}","typeGuard":null,"tryCatchPattern":"try {\n  const {flowBinDirName, flowBinName} = await getFlowBinRelativePath(p);\n} catch (err) {\n  if (/Failed to find anything starting with/.test(err.message)) {\n    // treat as corrupt install: prompt reinstall of flow-bin\n  } else throw err;\n}","preventionTips":["Use npm ci in CI for deterministic installs","Pin exact flow-bin versions","Watch for postinstall scripts being disabled, which can leave partial packages"],"tags":["flow-bin","npm","install-corruption","filesystem"],"backgroundTag":"corrupt-npm-install","analyzedSha":"d1341dac899a79c027762f6b423d896045287620","analyzedAt":"2026-08-17T00:07:02.212Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}