dotnet/aspnetcore · error · Error
The workspace path was not provided.
Error message
The workspace path was not provided.
What it means
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.
Source
Thrown at eng/scripts/npm/pack-workspace.mjs:22
import { execSync } from 'child_process';
import fsExtra from 'fs-extra';
const { existsSync, writeJsonSync, readJsonSync, moveSync, copySync, removeSync } = fsExtra;
import { applyVersions } from './update-dependency-versions.mjs';
// Valid actions are --update-versions and --create-packages
const action = process.argv[2];
const workspacePath = process.argv[3];
const defaultPackageVersion = process.argv[4];
const packageOutputPath = process.argv[5];
const intermediateOutputPath = process.argv[6];
// Validate and throw if the arguments are not provided
if (!workspacePath) {
throw new Error('The workspace path was not provided.');
}
if (!defaultPackageVersion) {
throw new Error('The default package version was not provided.');
}
if (!packageOutputPath) {
throw new Error('The package output path was not provided.');
}
if (!intermediateOutputPath) {
throw new Error('The intermediate output path was not provided.');
}
// Log all the captured process arguments
console.log(`Workspace Path: ${workspacePath}`);
console.log(`Default Package Version: ${defaultPackageVersion}`);
console.log(`Package Output Path: ${packageOutputPath}`);View on GitHub (pinned to 3600ca084e)
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>.
Example fix
// before node pack-workspace.mjs --update-versions // after node pack-workspace.mjs --update-versions ./src/FrameworkApp/package.json 8.0.0 ./artifacts/pkg ./artifacts/intermediate
Defensive patterns
Strategy: validation
Validate before calling
// Validate argv before delegating to the script
const [action, workspacePath, version, out, inter] = process.argv.slice(2);
if (!workspacePath) {
console.error('Usage: pack-workspace.mjs <action> <workspacePath> <version> <out> <intermediate>');
process.exit(2);
} Type guard
const isNonEmptyString = (s) => typeof s === 'string' && s.trim().length > 0;
Try / catch
try {
child_process.execFileSync('node', ['pack-workspace.mjs', action, workspacePath, version, out, inter]);
} catch (e) {
if (/workspace path was not provided/.test(e.message)) { /* fix the caller */ }
throw e;
} Prevention
- 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.
When it happens
Trigger: Invoking the script with fewer than the required positional arguments - specifically when argv[3] (workspacePath) is missing (pack-workspace.mjs:12,21-23).
Common situations: 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.
Related errors
- The default package version was not provided.
- The package output path was not provided.
- The intermediate output path was not provided.
- The action ${action} is not supported.
- The package output path ${packageOutputPath} does not exist.
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/be6880da0965d6f2.
Report an issue: GitHub.