pulumi/pulumi · error

unknown package manager: %s

Error message

unknown package manager: %s

What it means

When an explicit package manager name is passed to ResolvePackageManager, it is matched against the known types (npm, yarn, pnpm, bun) in a switch (sdk/nodejs/npm/manager.go:206-220). Any string that is not one of the recognized PackageManagerType constants falls into the default branch and returns this error. It is a strict allowlist check on the configured package manager name.

Source

Thrown at sdk/nodejs/npm/manager.go:219

			return nil, fmt.Errorf(
				"the project's manifest is package.yaml, which is only supported by pnpm, "+
					"but the runtime package manager is set to %q. "+
					"Use pnpm, or convert package.yaml to package.json", packagemanager)
		}
		switch packagemanager {
		case AutoPackageManager:
			// Make the linter for exhaustive switch cases happy, we never get here.
			break
		case NpmPackageManager:
			return newNPM()
		case YarnPackageManager:
			return newYarnClassic()
		case PnpmPackageManager:
			return newPnpm()
		case BunPackageManager:
			return newBun()
		default:
			return nil, fmt.Errorf("unknown package manager: %s", packagemanager)
		}
	}

	// No packagemanager specified, try to determine the best one to use.

	// If the nearest manifest is a package.yaml, pnpm is the only option. Don't fall through to the other package
	// managers since they would fail with a confusing ENOENT.
	if requiresPnpm {
		pnpm, err := newPnpm()
		if err != nil {
			return nil, fmt.Errorf("the project's manifest is package.yaml, which requires pnpm, "+
				"but pnpm could not be found on the $PATH: %w", err)
		}
		return pnpm, nil
	}

	// Prefer yarn if PULUMI_PREFER_YARN is truthy, or if yarn.lock exists.
	if preferYarn() || checkYarnLock(pwd) {

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Use one of the supported values exactly: npm, yarn, pnpm, or bun (lowercase)
  2. Check Pulumi.yaml runtime options.packagemanager for typos or casing errors
  3. Remove the packagemanager option entirely to let Pulumi auto-detect from lockfiles

Example fix

// before (Pulumi.yaml)
options:
  packagemanager: NPM
// after
options:
  packagemanager: npm
Defensive patterns

Strategy: validation

Validate before calling

var validManagers = map[string]bool{"npm": true, "yarn": true, "pnpm": true, "bun": true}

func validateManagerName(name string) error {
	if name != "" && name != string(npm.AutoPackageManager) && !validManagers[name] {
		return fmt.Errorf("unknown package manager %q; must be one of npm, yarn, pnpm, bun", name)
	}
	return nil
}

Prevention

When it happens

Trigger: Passing an unrecognized string as packagemanager to ResolvePackageManager, e.g. from a misspelled `packagemanager` option in Pulumi.yaml (such as "NPM", "yarn2", "npmclassic") that does not exactly match a supported value.

Common situations: Typo or wrong casing in Pulumi.yaml's runtime options.packagemanager; using a value from an older or newer Pulumi version that no longer exists; hand-editing config with an invented manager name like "pnpm9".

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/d2e79b275b6e30ca. Report an issue: GitHub.