{"record":{"id":"e3cc8571935c06a7","repo":"facebook/flow","slug":"flow-not-found","errorCode":null,"errorMessage":"Flow not found","messagePattern":"Flow not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/flow-for-vscode/src/utils/getFlowPath.ts","lineNumber":74,"sourceCode":"    return flowPath;\n  } catch (err: any) {\n    logger.error(\n      `Error loading flow using option 'pathToFlow'\\n${err.message}`,\n    );\n  }\n\n  // 3) if nothing works fallback to bundled flow\n  if (useBundledFlow) {\n    try {\n      const flowPath = getBundledFlowPath();\n      logger.info('Falling back to bundled flow.');\n      return flowPath;\n    } catch (err: any) {\n      logger.error(`Failed to load bundled flow.\\n${err.message}`);\n    }\n  }\n\n  throw new Error('Flow not found');\n}\n\nasync function getNpmPackagedFlow(\n  flowconfigDir: string,\n  workspaceRoot: string,\n  logger: Logger,\n): Promise<string> {\n  const dirsToCheck = [\n    // a) check in flowconfig dir\n    flowconfigDir,\n    // b) check in workspaceRoot (ignore if flowconfigDir and workspaceRoot same)\n    flowconfigDir !== workspaceRoot ? workspaceRoot : null,\n  ].filter((v) => v != null);\n\n  for (let i = 0; i < dirsToCheck.length; i += 1) {\n    // eslint-disable-next-line no-await-in-loop\n    const flowPath = await getFlowBinPath(dirsToCheck[i], logger);\n    if (flowPath) {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/facebook/flow/blob/d1341dac899a79c027762f6b423d896045287620/packages/flow-for-vscode/src/utils/getFlowPath.ts#L56-L92","documentation":"getFlowPath resolves the flow binary in order: (1) npm-packaged flow-bin in the flowconfig dir / workspace root, (2) the pathToFlow setting resolved against those dirs and looked up on PATH, (3) the extension's bundled flow. Each failure is logged; when every enabled strategy fails it throws the terminal 'Flow not found'.","triggerScenarios":"useNPMPackagedFlow enabled but flow-bin not installed in either dir; pathToFlow pointing at a nonexistent command; useBundledFlow disabled or the bundled module missing — or any combination.","commonSituations":"Fresh clone before `npm install`; pathToFlow set to a global `flow` not on the GUI VS Code process's PATH; bundled flow excluded in custom builds; monorepos where neither flowconfig dir nor workspace root has flow-bin.","solutions":["Install flow-bin where the extension looks: `npm install --save-dev flow-bin` in the flowconfig dir or workspace root","Set `flow.pathToFlow` to the absolute path of a working flow binary","If you disabled bundled flow (`flow.useBundledFlow`), re-enable it or install one of the above","Read the Flow output channel: every failed strategy logs its reason before the final throw"],"exampleFix":"// before (VS Code settings.json)\n{ \"flow.pathToFlow\": \"flow\", \"flow.useNPMPackagedFlow\": false }\n\n// after (VS Code settings.json)\n{\n  \"flow.pathToFlow\": \"/abs/path/to/project/node_modules/.bin/flow\",\n  \"flow.useNPMPackagedFlow\": true\n}\n// plus: npm install --save-dev flow-bin","handlingStrategy":"fallback","validationCode":"import {access} from 'fs/promises';\nimport path from 'path';\n\nasync function flowLikelyResolvable(flowconfigDir: string, workspaceRoot: string): Promise<boolean> {\n  const candidates = [\n    path.join(flowconfigDir, 'node_modules', '.bin', 'flow'),\n    path.join(workspaceRoot, 'node_modules', '.bin', 'flow'),\n  ];\n  for (const c of candidates) {\n    try { await access(c); return true; } catch {}\n  }\n  return false;\n}","typeGuard":null,"tryCatchPattern":"try {\n  const flowPath = await getFlowPath(params);\n} catch (err) {\n  if (err instanceof Error && err.message === 'Flow not found') {\n    // prompt the user to install flow-bin or configure pathToFlow,\n    // then degrade gracefully (no language server)\n  } else throw err;\n}","preventionTips":["Commit flow-bin as a devDependency of the project owning the .flowconfig","Use an absolute pathToFlow when relying on custom binaries","Verify with `npx flow version` after clone/install"],"tags":["flow","vscode","binary","path","resolution"],"backgroundTag":"binary-not-found","analyzedSha":"d1341dac899a79c027762f6b423d896045287620","analyzedAt":"2026-08-17T00:07:02.212Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}