dotnet/aspnetcore · error · Error

The action ${action} is not supported.

Error message

The action ${action} is not supported.

What it means

pack-workspace.mjs supports exactly two actions: --update-versions and --create-packages (pack-workspace.mjs:9,43-66). Any other value for the first positional argument falls into the else branch and throws.

Source

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

  writeJsonSync(resolve(intermediateOutputPath, 'renames.json'), renames);
} else if (action === '--create-packages') {
  if (!existsSync(packageOutputPath)) {
    throw new Error(`The package output path ${packageOutputPath} does not exist.`);
  }

  // Read packagesToPack and renames from a file
  const packagesToPack = readJsonSync(resolve(intermediateOutputPath, 'packagesToPack.json'));
  const renames = readJsonSync(resolve(intermediateOutputPath, 'renames.json'));
  try {
    createPackages(packagesToPack);
  } finally {
    // Restore the package.json files to their "originals"
    for (const [from, to] of renames) {
      moveSync(from, to, { overwrite: true });
    }
  }
} else {
  throw new Error(`The action ${action} is not supported.`);
}

// For each package to pack run npm pack
function createPackages(packagesToPack) {
  // The repo's LICENSE file lives at the root of the workspace next to package.json.
  const licenseSourcePath = resolve(dirname(workspacePath), 'LICENSE.txt');
  if (!existsSync(licenseSourcePath)) {
    throw new Error(`The license file ${licenseSourcePath} does not exist.`);
  }

  for (const [packagePath, packageJson] of packagesToPack) {
    const packageName = packageJson.name;
    const packageVersion = defaultPackageVersion;
    const packageDir = dirname(packagePath);
    const normalizedPackageName = packageName.replace('@', '').replace('/', '-');
    const packageFileName = `${normalizedPackageName}-${packageVersion}.tgz`;
    const packageTarball = resolve(packageDir, `${packageFileName}`);

View on GitHub (pinned to 3600ca084e)

Solutions

  1. Use exactly '--update-versions' or '--create-packages' as the first positional argument.
  2. Check for typos and trailing whitespace in the action passed by the build target.
  3. If argv[2] is undefined, ensure the MSBuild Exec task actually passes the action property.

Example fix

// before
node pack-workspace.mjs --create-package ./pkg/package.json 8.0.0 out int
// after
node pack-workspace.mjs --create-packages ./pkg/package.json 8.0.0 out int
Defensive patterns

Strategy: validation

Validate before calling

const VALID_ACTIONS = new Set(['--update-versions', '--create-packages']);
if (!VALID_ACTIONS.has(action)) {
    throw new Error(`Unsupported action '${action}'. Use one of: ${[...VALID_ACTIONS].join(', ')}`);
}

Type guard

const isKnownAction = (a) => a === '--update-versions' || a === '--create-packages';

Prevention

When it happens

Trigger: Invoking the script with an action that is neither --update-versions nor --create-packages (pack-workspace.mjs:64-66).

Common situations: A typo in the action string, a stale build script referencing a renamed action, or omitting the action so process.argv[2] is undefined.

Related errors


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