{"record":{"id":"be6880da0965d6f2","repo":"dotnet/aspnetcore","slug":"the-workspace-path-was-not-provided","errorCode":null,"errorMessage":"The workspace path was not provided.","messagePattern":"The workspace path was not provided\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"eng/scripts/npm/pack-workspace.mjs","lineNumber":22,"sourceCode":"import { execSync } from 'child_process';\nimport fsExtra from 'fs-extra';\nconst { existsSync, writeJsonSync, readJsonSync, moveSync, copySync, removeSync } = fsExtra;\nimport { applyVersions } from './update-dependency-versions.mjs';\n\n// Valid actions are --update-versions and --create-packages\nconst action = process.argv[2];\n\nconst workspacePath = process.argv[3];\n\nconst defaultPackageVersion = process.argv[4];\n\nconst packageOutputPath = process.argv[5];\n\nconst intermediateOutputPath = process.argv[6];\n\n// Validate and throw if the arguments are not provided\nif (!workspacePath) {\n  throw new Error('The workspace path was not provided.');\n}\n\nif (!defaultPackageVersion) {\n  throw new Error('The default package version was not provided.');\n}\n\nif (!packageOutputPath) {\n  throw new Error('The package output path was not provided.');\n}\n\nif (!intermediateOutputPath) {\n  throw new Error('The intermediate output path was not provided.');\n}\n\n// Log all the captured process arguments\nconsole.log(`Workspace Path: ${workspacePath}`);\nconsole.log(`Default Package Version: ${defaultPackageVersion}`);\nconsole.log(`Package Output Path: ${packageOutputPath}`);","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/3600ca084e9c8b5f4174fc5e747f4c52d2100806/eng/scripts/npm/pack-workspace.mjs#L4-L40","documentation":"pack-workspace.mjs reads positional CLI args from process.argv[2..6]. The third argv element (argv[3], after the script path and the action) must be the workspace package.json path; if it is empty/undefined the script aborts before doing any work.","triggerScenarios":"Invoking the script with fewer than the required positional arguments - specifically when argv[3] (workspacePath) is missing (pack-workspace.mjs:12,21-23).","commonSituations":"An MSBuild target that invokes the script is missing the $(WorkspacePackageJson) property; running the .mjs file manually for debugging without all args; a CI template change that dropped the argument.","solutions":["Pass the workspace package.json path as the 3rd positional argument when invoking pack-workspace.mjs.","Check the MSBuild target that calls the script - confirm the property feeding workspacePath is set and not empty.","Run the script with all six positional args: <action> <workspacePath> <version> <outPath> <intermediatePath>."],"exampleFix":"// before\nnode pack-workspace.mjs --update-versions\n// after\nnode pack-workspace.mjs --update-versions ./src/FrameworkApp/package.json 8.0.0 ./artifacts/pkg ./artifacts/intermediate","handlingStrategy":"validation","validationCode":"// Validate argv before delegating to the script\nconst [action, workspacePath, version, out, inter] = process.argv.slice(2);\nif (!workspacePath) {\n    console.error('Usage: pack-workspace.mjs <action> <workspacePath> <version> <out> <intermediate>');\n    process.exit(2);\n}","typeGuard":"const isNonEmptyString = (s) => typeof s === 'string' && s.trim().length > 0;","tryCatchPattern":"try {\n  child_process.execFileSync('node', ['pack-workspace.mjs', action, workspacePath, version, out, inter]);\n} catch (e) {\n  if (/workspace path was not provided/.test(e.message)) { /* fix the caller */ }\n  throw e;\n}","preventionTips":["Pass all six positional args when invoking pack-workspace.mjs.","Set the MSBuild property feeding workspacePath on the target.","Document the exact argv order at the call site."],"tags":["nodejs","npm","build","cli","arguments"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}