{"record":{"id":"d5ea66ab6387b6d0","repo":"hcengineering/platform","slug":"unable-to-determine-the-required-version-of-rush-f-d5ea66","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/server/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/server/common/scripts/install-run-rush.js#L125-L161","documentation":"install-run-rush.js parses rush.json with a regex to find the \"rushVersion\" field (avoiding extra dependencies since rush.json allows comments). If the regex finds no match, rushJsonMatches is null and accessing [1] throws inside the catch, producing this error. It means Rush could not determine which version of itself to install.","triggerScenarios":"rush.json is missing the \"rushVersion\" field entirely; the field uses single quotes, no quotes, or a value with characters outside [0-9a-zA-Z.+-]; rush.json is malformed so reading it throws; the wrong rush.json file was located.","commonSituations":"Hand-edited rush.json where the version was removed or reformatted; tools rewriting rush.json with non-standard JSON syntax; repo bootstrap scripts run before rush.json is committed; typos like rushVerion.","solutions":["Open rush.json and ensure a properly quoted field exists: \"rushVersion\": \"5.x.x\"","Ensure the value contains only digits, letters, dots, plus and hyphen (valid semver, no spaces)","Validate rush.json parses (comments allowed) and that the script found the correct repo root rush.json","Commit a known-good rush.json from the Rush template if the file is corrupted"],"exampleFix":"// before\n{\n  // \"rushVersion\": ,\n  \"npmVersion\": \"6.14.0\"\n}\n// after\n{\n  \"rushVersion\": \"5.102.0\",\n  \"npmVersion\": \"6.14.0\"\n}","handlingStrategy":"validation","validationCode":"const contents = fs.readFileSync('rush.json', 'utf8');\nconst m = contents.match(/\"rushVersion\"\\s*:\\s*\"([0-9a-zA-Z.+\\-]+)\"/);\nif (!m) throw new Error('rush.json is missing a valid quoted \"rushVersion\" field');","typeGuard":"function hasRushVersion(contents) {\n  return /\"rushVersion\"\\s*:\\s*\"[0-9a-zA-Z.+\\-]+\"/.test(contents);\n}","tryCatchPattern":"try {\n  runRushScript();\n} catch (e) {\n  if (String(e).includes(\"Unable to determine the required version of Rush\")) {\n    console.error('Fix rush.json: add \"rushVersion\": \"<semver>\"');\n  } else throw e;\n}","preventionTips":["Never hand-edit rushVersion; use `rush update` or the Rush upgrade tool","Keep rush.json committed and validate it in CI before running bootstrap scripts","Use only plain double-quoted semver values in rush.json"],"tags":["rush","config","version-parsing"],"backgroundTag":"missing-config-field","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}