{"record":{"id":"9bd0b8b0499fbf46","repo":"hcengineering/platform","slug":"invalid-package-specifier-rawpackagespecifier-9bd0b8","errorCode":null,"errorMessage":"Invalid package specifier: ${rawPackageSpecifier}","messagePattern":"Invalid package specifier: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"foundations/core/common/scripts/install-run.js","lineNumber":366,"sourceCode":"function _parsePackageSpecifier(rawPackageSpecifier) {\n    rawPackageSpecifier = (rawPackageSpecifier || '').trim();\n    const separatorIndex = rawPackageSpecifier.lastIndexOf('@');\n    let name;\n    let version = undefined;\n    if (separatorIndex === 0) {\n        // The specifier starts with a scope and doesn't have a version specified\n        name = rawPackageSpecifier;\n    }\n    else if (separatorIndex === -1) {\n        // The specifier doesn't have a version\n        name = rawPackageSpecifier;\n    }\n    else {\n        name = rawPackageSpecifier.substring(0, separatorIndex);\n        version = rawPackageSpecifier.substring(separatorIndex + 1);\n    }\n    if (!name) {\n        throw new Error(`Invalid package specifier: ${rawPackageSpecifier}`);\n    }\n    return { name, version };\n}\nlet _npmPath = undefined;\n/**\n * Get the absolute path to the npm executable\n */\nfunction getNpmPath() {\n    if (!_npmPath) {\n        try {\n            if (_isWindows()) {\n                // We're on Windows\n                const whereOutput = child_process__WEBPACK_IMPORTED_MODULE_0__.execSync('where npm', { stdio: [] }).toString();\n                const lines = whereOutput.split(os__WEBPACK_IMPORTED_MODULE_2__.EOL).filter((line) => !!line);\n                // take the last result, we are looking for a .cmd command\n                // see https://github.com/microsoft/rushstack/issues/759\n                _npmPath = lines[lines.length - 1];\n            }","sourceCodeStart":348,"sourceCodeEnd":384,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/core/common/scripts/install-run.js#L348-L384","documentation":"_parsePackageSpecifier splits a raw specifier like 'name@version' into package name and version. If the name portion comes out empty — e.g. the specifier starts with '@' without a scoped name, or is empty — it throws this error naming the offending raw specifier.","triggerScenarios":"Calling the script with a package specifier argument that is empty, or like '@' / '@@version' / '@/' such that parsing yields an empty name.","commonSituations":"Typo in the install-run-rush.js command line (dangling '@' with no package name); shell expansion swallowing the package name; copy-pasting a partial specifier.","solutions":["Pass a complete specifier: rush@5.100.1 or @microsoft/rush@5.100.1","Ensure the '@' separator is followed by an actual package name","Quote the argument in your shell so it isn't expanded or split"],"exampleFix":"// before\nnode install-run-rush.js @ build\n// after\nnode install-run-rush.js @microsoft/rush@5.100.1 build","handlingStrategy":"validation","validationCode":"const spec = process.argv[2] ?? '';\nif (!spec || !/^(@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*(@.+)?$/.test(spec)) throw new Error(`Malformed package specifier: ${spec}`);","typeGuard":null,"tryCatchPattern":"try { parseSpecifier(raw); }\ncatch (e) { if (/Invalid package specifier/.test(e.message)) { console.error('Use <name> or <name>@<version>, e.g. rush@5.100.1'); } else throw e; }","preventionTips":["Quote specifiers in the shell to prevent '@' expansion issues","Copy full specifiers including name and version","Validate CLI args in wrapper scripts before delegating"],"tags":["parsing","cli-argument","package-specifier"],"backgroundTag":"invalid-package-specifier","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}