{"record":{"id":"15a333ae87f822d0","repo":"dotnet/aspnetcore","slug":"the-default-package-version-was-not-provided","errorCode":null,"errorMessage":"The default package version was not provided.","messagePattern":"The default package version was not provided\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"eng/scripts/npm/pack-workspace.mjs","lineNumber":26,"sourceCode":"\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}`);\nconsole.log(`Intermediate Output Path: ${intermediateOutputPath}`);\n\nif (action === '--update-versions') {\n  const [packagesToPack, renames] = applyVersions(defaultPackageVersion, workspacePath);","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/dotnet/aspnetcore/blob/3600ca084e9c8b5f4174fc5e747f4c52d2100806/eng/scripts/npm/pack-workspace.mjs#L8-L44","documentation":"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.","triggerScenarios":"Invoking the script with argv[4] (defaultPackageVersion) missing or empty (pack-workspace.mjs:14,25-27).","commonSituations":"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.","solutions":["Supply a semver-style default package version as the 4th positional argument.","Ensure the MSBuild/property that populates the version is defined and non-empty before the script runs.","Validate the version is set in CI before invoking pack-workspace.mjs."],"exampleFix":"// before\nnode pack-workspace.mjs --update-versions ./pkg/package.json\n// after\nnode pack-workspace.mjs --update-versions ./pkg/package.json 8.0.0","handlingStrategy":"validation","validationCode":"if (!process.argv[4]) {\n    console.error('Default package version (argv[4]) is required');\n    process.exit(2);\n}","typeGuard":"const isSemverish = (s) => typeof s === 'string' && /^\\d+\\.\\d+/.test(s);","tryCatchPattern":null,"preventionTips":["Populate the build version property before the pack target runs.","Pass the version as argv[4] to pack-workspace.mjs.","Add a CI precondition that the version is non-empty."],"tags":["nodejs","npm","build","cli","arguments","versioning"],"backgroundTag":null,"analyzedSha":"3600ca084e9c8b5f4174fc5e747f4c52d2100806","analyzedAt":"2026-08-11T16:32:30.678Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}