dotnet/aspnetcore · error · Error

The default package version was not provided.

Error message

The default package version was not provided.

What it means

pack-workspace.mjs requires a default package version as argv[4]. It is used both to stamp each workspace package's version and to derive dependency version ranges, so it cannot be blank.

Source

Thrown at eng/scripts/npm/pack-workspace.mjs:26

// 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}`);
console.log(`Intermediate Output Path: ${intermediateOutputPath}`);

if (action === '--update-versions') {
  const [packagesToPack, renames] = applyVersions(defaultPackageVersion, workspacePath);

View on GitHub (pinned to 3600ca084e)

Solutions

  1. Supply a semver-style default package version as the 4th positional argument.
  2. Ensure the MSBuild/property that populates the version is defined and non-empty before the script runs.
  3. Validate the version is set in CI before invoking pack-workspace.mjs.

Example fix

// before
node pack-workspace.mjs --update-versions ./pkg/package.json
// after
node pack-workspace.mjs --update-versions ./pkg/package.json 8.0.0
Defensive patterns

Strategy: validation

Validate before calling

if (!process.argv[4]) {
    console.error('Default package version (argv[4]) is required');
    process.exit(2);
}

Type guard

const isSemverish = (s) => typeof s === 'string' && /^\d+\.\d+/.test(s);

Prevention

When it happens

Trigger: Invoking the script with argv[4] (defaultPackageVersion) missing or empty (pack-workspace.mjs:14,25-27).

Common situations: The build orchestrator did not pass $(Version) / a NuGet package version property to the script, or it passed an empty string when the version variable was unset at build time.

Related errors


AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11). Data as JSON: /api/errors/15a333ae87f822d0. Report an issue: GitHub.