{"record":{"id":"6b8148ef0ac49fec","repo":"hcengineering/platform","slug":"unable-to-determine-the-required-version-of-rush-f-6b8148","errorCode":null,"errorMessage":"Unable to determine the required version of Rush from ${RUSH_JSON_FILENAME} (${rushJsonFolder}). The 'rushVersion' field is either not assigned in ${RUSH_JSON_FILENAME} or was specified using an unexpected syntax.","messagePattern":"Unable to determine the required version of Rush from (.+?) \\((.+?)\\)\\. The 'rushVersion' field is either not assigned in (.+?) or was specified using an unexpected syntax\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/net/common/scripts/install-run-rush.js","lineNumber":143,"sourceCode":"const RUSH_PREVIEW_VERSION = 'RUSH_PREVIEW_VERSION';\nconst INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE = 'INSTALL_RUN_RUSH_LOCKFILE_PATH';\nfunction _getRushVersion(logger) {\n    const rushPreviewVersion = process.env[RUSH_PREVIEW_VERSION];\n    if (rushPreviewVersion !== undefined) {\n        logger.info(`Using Rush version from environment variable ${RUSH_PREVIEW_VERSION}=${rushPreviewVersion}`);\n        return rushPreviewVersion;\n    }\n    const rushJsonFolder = findRushJsonFolder();\n    const rushJsonPath = path__WEBPACK_IMPORTED_MODULE_0__.join(rushJsonFolder, RUSH_JSON_FILENAME);\n    try {\n        const rushJsonContents = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(rushJsonPath, 'utf-8');\n        // Use a regular expression to parse out the rushVersion value because rush.json supports comments,\n        // but JSON.parse does not and we don't want to pull in more dependencies than we need to in this script.\n        const rushJsonMatches = rushJsonContents.match(/\\\"rushVersion\\\"\\s*\\:\\s*\\\"([0-9a-zA-Z.+\\-]+)\\\"/);\n        return rushJsonMatches[1];\n    }\n    catch (e) {\n        throw new Error(`Unable to determine the required version of Rush from ${RUSH_JSON_FILENAME} (${rushJsonFolder}). ` +\n            `The 'rushVersion' field is either not assigned in ${RUSH_JSON_FILENAME} or was specified ` +\n            'using an unexpected syntax.');\n    }\n}\nfunction _getBin(scriptName) {\n    switch (scriptName.toLowerCase()) {\n        case 'install-run-rush-pnpm.js':\n            return 'rush-pnpm';\n        case 'install-run-rushx.js':\n            return 'rushx';\n        default:\n            return 'rush';\n    }\n}\nfunction _run() {\n    const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv;\n    // Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the\n    // appropriate binary inside the rush package to run","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/net/common/scripts/install-run-rush.js#L125-L161","documentation":"install-run-rush.js bootstraps the correct Rush version by reading rush.json with a regex that expects a quoted \"rushVersion\": \"x.y.z\" field. If rush.json is missing the field, malformed, or uses syntax the regex can't match, it throws this generic Error instead of returning a version.","triggerScenarios":"Running install-run-rush.js (e.g. via the rush bootstrap script) where the repo's rush.json either lacks rushVersion, has it commented out, uses single quotes/unquoted values, or the file itself could not be read/parsed.","commonSituations":"A freshly scaffolded repo where rush.json was hand-edited; upgrading Rush left an invalid or commented-out rushVersion; a JSON5-style config the strict regex cannot parse; rush.json located in the wrong folder passed as rushJsonFolder.","solutions":["Open rush.json and ensure it contains a properly quoted \"rushVersion\": \"5.x.x\" field (double quotes, no comments inside the value).","Validate rush.json is valid JSON and readable at the expected rushJsonFolder location.","Restore rushVersion from a known-good template or re-run the Rush upstream sync to regenerate rush.json.","If the version needs a range or non-standard syntax, run rush directly via a globally installed @microsoft/rush instead of this bootstrap script."],"exampleFix":"// before (rush.json)\n{\n  // \"rushVersion\": \"5.62.0\"\n}\n// after\n{\n  \"rushVersion\": \"5.62.0\"\n}","handlingStrategy":"validation","validationCode":"const rushJson = JSON.parse(fs.readFileSync('rush.json', 'utf8').replace(/\\/\\/.*$/gm, ''))\nif (!/^\\d+\\.\\d+\\.\\d+(-[0-9a-zA-Z.]+)?$/.test(rushJson.rushVersion ?? '')) {\n  throw new Error('rush.json rushVersion missing or malformed')\n}","typeGuard":"function hasValidRushVersion(json: unknown): json is { rushVersion: string } {\n  return typeof (json as any)?.rushVersion === 'string' &&\n    /^\\d+\\.\\d+\\.\\d+/.test((json as any).rushVersion)\n}","tryCatchPattern":null,"preventionTips":["Always edit rush.json with the rush CLI (rush update / rush version bump) instead of by hand.","Keep rushVersion in semver x.y.z form with double quotes; never comment out the field.","Add a repo lint rule/CI check that parses rush.json and asserts rushVersion matches /\\d+\\.\\d+\\.\\d+/.","After rebase/merge, diff rush.json to catch dropped or mangled rushVersion fields."],"tags":["build-tooling","rush","config"],"backgroundTag":"rush-version-not-determined","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}