{"record":{"id":"06657b50012a59fc","repo":"hcengineering/platform","slug":"error-building-local-installation-folder-join-b","errorCode":null,"errorMessage":"Error building local installation folder (${join(baseFolder, ...pathSegments)}): ${e}","messagePattern":"Error building local installation folder \\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/utils/common/scripts/install-run.js","lineNumber":425,"sourceCode":"/**\n * Create missing directories under the specified base directory, and return the resolved directory.\n *\n * Does not support \".\" or \"..\" path segments.\n * Assumes the baseFolder exists.\n */\nfunction _ensureAndJoinPath(baseFolder, ...pathSegments) {\n    let joinedPath = baseFolder;\n    try {\n        for (let pathSegment of pathSegments) {\n            pathSegment = pathSegment.replace(/[\\\\\\/]/g, '+');\n            joinedPath = path__WEBPACK_IMPORTED_MODULE_3__.join(joinedPath, pathSegment);\n            if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(joinedPath)) {\n                fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync(joinedPath);\n            }\n        }\n    }\n    catch (e) {\n        throw new Error(`Error building local installation folder (${path__WEBPACK_IMPORTED_MODULE_3__.join(baseFolder, ...pathSegments)}): ${e}`);\n    }\n    return joinedPath;\n}\nfunction _getRushTempFolder(rushCommonFolder) {\n    const rushTempFolder = process.env[RUSH_TEMP_FOLDER_ENV_VARIABLE_NAME];\n    if (rushTempFolder !== undefined) {\n        _ensureFolder(rushTempFolder);\n        return rushTempFolder;\n    }\n    else {\n        return _ensureAndJoinPath(rushCommonFolder, 'temp');\n    }\n}\n/**\n * Compare version strings according to semantic versioning.\n * Returns a positive integer if \"a\" is a later version than \"b\",\n * a negative integer if \"b\" is later than \"a\",\n * and 0 otherwise.","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/utils/common/scripts/install-run.js#L407-L443","documentation":"_ensureAndJoinPath builds and creates a directory under a base folder (creating each segment with mkdirSync if missing). Any failure in creating or stat-ing the joined path is wrapped in this error, which names the full target path and the underlying cause. Callers use it for the rush temp folder, rush-recycler folder, package install folder, and rush common folder.","triggerScenarios":"mkdirSync fails (EACCES, EPERM, EEXIST race, ENOSPC) or existsSync throws while constructing rush temp/common/recycler/package-install folders via _getRushTempFolder, rushRecyclerFolder, packageInstallFolder, or rushCommonFolder.","commonSituations":"RUSH_TEMP_FOLDER env var points to a read-only or nonexistent drive; running in a container as non-root without write access to the repo's common/ folder; disk full; antivirus locking the directory during creation.","solutions":["Check permissions on the base folder and ensure the process user can create directories there","Set RUSH_TEMP_FOLDER to a writable location (e.g. a temp dir) via process env","Free disk space if the disk is full","Check the wrapped cause (`... : ${e}`) in the message to identify the exact fs error (EACCES/ENOSPC/EEXIST)"],"exampleFix":"// before\nRUSH_TEMP_FOLDER=/mnt/readonly/tmp\n// after\nexport RUSH_TEMP_FOLDER=\"$(mktemp -d)\"","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nfunction assertWritableDir(base) {\n  fs.mkdirSync(base, { recursive: true });\n  fs.accessSync(base, fs.constants.W_OK);\n}\nassertWritableDir(process.env.RUSH_TEMP_FOLDER || require('path').join(repoRoot, 'common', 'temp'));","typeGuard":null,"tryCatchPattern":"try {\n  installAndRun(/* ... */);\n} catch (e) {\n  if (String(e.message).startsWith('Error building local installation folder')) {\n    console.error('Check RUSH_TEMP_FOLDER and folder permissions:', e.message);\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["Point RUSH_TEMP_FOLDER at a guaranteed-writable temp dir in CI","Run container jobs as a user with write access to the workspace","Monitor disk space on runners"],"tags":["filesystem","permissions","directory-creation"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}