{"record":{"id":"f830e4b25a171f21","repo":"hcengineering/platform","slug":"unable-to-find-rush-json-filename-f830e4","errorCode":null,"errorMessage":"Unable to find ${RUSH_JSON_FILENAME}.","messagePattern":"Unable to find (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/net/common/scripts/install-run.js","lineNumber":548,"sourceCode":"/**\n * Find the absolute path to the folder containing rush.json\n */\nfunction findRushJsonFolder() {\n    if (!_rushJsonFolder) {\n        let basePath = __dirname;\n        let tempPath = __dirname;\n        do {\n            const testRushJsonPath = path__WEBPACK_IMPORTED_MODULE_3__.join(basePath, RUSH_JSON_FILENAME);\n            if (fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(testRushJsonPath)) {\n                _rushJsonFolder = basePath;\n                break;\n            }\n            else {\n                basePath = tempPath;\n            }\n        } while (basePath !== (tempPath = path__WEBPACK_IMPORTED_MODULE_3__.dirname(basePath))); // Exit the loop when we hit the disk root\n        if (!_rushJsonFolder) {\n            throw new Error(`Unable to find ${RUSH_JSON_FILENAME}.`);\n        }\n    }\n    return _rushJsonFolder;\n}\n/**\n * Detects if the package in the specified directory is installed\n */\nfunction _isPackageAlreadyInstalled(packageInstallFolder) {\n    try {\n        const flagFilePath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, INSTALLED_FLAG_FILENAME);\n        if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(flagFilePath)) {\n            return false;\n        }\n        const fileContents = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(flagFilePath).toString();\n        return fileContents.trim() === process.version;\n    }\n    catch (e) {\n        return false;","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/net/common/scripts/install-run.js#L530-L566","documentation":"findRushJsonFolder walks up from the current directory (via __dirname of the script and successive path.dirname calls) looking for rush.json. If it reaches the disk root without finding one and _rushJsonFolder was never set, it throws 'Unable to find rush.json.' The script requires being run inside (or below) a Rush repository.","triggerScenarios":"Running install-run-rush.js (or the install-run scripts that call findRushJsonFolder via rushJsonFolder) from a directory outside any Rush monorepo — no rush.json exists in the current folder or any ancestor up to the filesystem root.","commonSituations":"Cloning only a subfolder of a monorepo without the root; running the script in a temp/CI working directory that never had rush.json; renaming or deleting rush.json; running the script outside the repo entirely (e.g. from $HOME on a CI runner).","solutions":["Run the script from inside a Rush repository (any folder that has rush.json in it or an ancestor).","Verify rush.json exists at the repo root and is named exactly 'rush.json' (not rushx.json, rush.json5, etc.).","Fix CI cwd so the job starts in the cloned repository directory.","If invoking from elsewhere, cd into the repo first: the upward search starts near the script location/working directory."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nfunction assertInsideRushRepo(startDir) {\n  let dir = path.resolve(startDir);\n  for (;;) {\n    if (fs.existsSync(path.join(dir, 'rush.json'))) return dir;\n    const parent = path.dirname(dir);\n    if (parent === dir) throw new Error(`No rush.json found above ${startDir}; run from inside a Rush repo.`);\n    dir = parent;\n  }\n}\nassertInsideRushRepo(process.cwd());","typeGuard":null,"tryCatchPattern":"try {\n  runInstallRun();\n} catch (e) {\n  if (/Unable to find rush\\.json/.test(e.message)) {\n    console.error('Run this script from inside a Rush monorepo (rush.json not found in any parent directory).');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Always invoke the script with cwd inside the monorepo.","Verify rush.json exists (and wasn't renamed/deleted) in CI before running.","In CI, explicitly cd into the repository checkout directory.","Never run install-run scripts from $HOME or temp dirs."],"tags":["rush","config","monorepo","file-not-found"],"backgroundTag":"missing-config-file","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}