dotnet/aspnetcore · error · Error
The default package version was not provided.
Error message
The default package version was not provided.
What it means
applyVersions in update-dependency-versions.mjs requires a non-empty defaultPackageVersion; it is used to stamp every public workspace package's version and to derive dependency version ranges ('>=<version>'). Without it the versioning step cannot run.
Source
Thrown at eng/scripts/npm/update-dependency-versions.mjs:18
import path from 'path';
import { execSync } from 'child_process';
import fs from 'fs-extra';
export function applyVersions(defaultPackageVersion, workspacePath) {
// Get the workspace package.json from the provided path
const workspacePackage = fs.readJsonSync(workspacePath);
// Get the workspace directory
const workspaceDir = path.dirname(workspacePath);
// 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.');
}
const packages = workspacePackage.workspaces;
const packagesToPack = [];
for (const pkg of packages) {
const packagePath = path.resolve(workspaceDir, pkg, 'package.json');
const packageJson = JSON.parse(fs.readFileSync(packagePath, 'utf-8'));
if (!packageJson.private) {
packagesToPack.push([packagePath, packageJson]);
} else {
console.log(`Skipping ${packageJson.name} because it is marked as private.`);
}
}
// For each package to be packed, run npm version to apply the version
var renames = applyPackageVersion(packagesToPack, defaultPackageVersion);
updateDependencyVersions(packagesToPack);View on GitHub (pinned to 3600ca084e)
Solutions
- Pass a non-empty default package version into pack-workspace.mjs (argv[4]).
- Ensure the MSBuild/CI property supplying the version is populated before the pack target runs.
- Add a precondition check in the build target that the version property is set.
Example fix
// before
applyVersions('', workspacePath);
// after
applyVersions('8.0.0', workspacePath); Defensive patterns
Strategy: validation
Validate before calling
if (!defaultPackageVersion) {
throw new Error('The default package version was not provided.');
} Type guard
const isVersion = (s) => typeof s === 'string' && /^\d+\.\d+\.\d+/.test(s);
Prevention
- Pass a non-empty version as argv[4] to pack-workspace.mjs.
- Ensure the build version property is populated in CI.
- Add a precondition check in the MSBuild target.
When it happens
Trigger: Calling applyVersions(defaultPackageVersion, workspacePath) with defaultPackageVersion empty/undefined (update-dependency-versions.mjs:17-19). Unlike the workspacePath guard this check runs after readJsonSync, but defaultPackageVersion is not used until later so the guard is reachable.
Common situations: The build property feeding the package version (e.g. $(Version)) was empty when pack-workspace.mjs invoked applyVersions; the CI pipeline did not set a build number.
Related errors
- The default package version was not provided.
- The workspace path was not provided.
- The package output path was not provided.
- The intermediate output path was not provided.
- The action ${action} is not supported.
AI-assisted analysis of dotnet/aspnetcore@3600ca084e (2026-08-11).
Data as JSON: /api/errors/cb38a10be4f3d51f.
Report an issue: GitHub.