pulumi/pulumi · error

failed to load language plugin %s: %w

Error message

failed to load language plugin %s: %w

What it means

This error wraps a failure from ctx.Host.LanguageRuntime when the Pulumi engine cannot locate or load the language plugin for the project's runtime (e.g. nodejs, python, yaml) while installing policy pack dependencies. The cloud backend needs a language runtime to run the project's install hooks before publishing the policy pack. The wrapped error from the plugin host names the actual root cause (plugin not found, incompatible version, download failure).

Source

Thrown at pkg/backend/httpstate/policypack.go:563

	if err != nil {
		return fmt.Errorf("failed to load policy project at %s: %w", finalDir, err)
	}

	// Workaround for python, some policy packs don't specify a venv but we want to use one
	if proj.Runtime.Name() == "python" {
		// If the policy's options provide a virtualenv use it, else default to "venv"
		if _, has := proj.Runtime.Options()["virtualenv"]; !has {
			proj.Runtime.SetOption("virtualenv", "venv")
			err = proj.Save(projPath)
			if err != nil {
				return fmt.Errorf("failed to save policy project at %s: %w", finalDir, err)
			}
		}
	}

	language, err := ctx.Host.LanguageRuntime(ctx, proj.Runtime.Name())
	if err != nil {
		return fmt.Errorf("failed to load language plugin %s: %w", proj.Runtime.Name(), err)
	}

	info := plugin.NewProgramInfo(finalDir, finalDir, ".", proj.Runtime.Options())
	err = pkgCmdUtil.InstallDependencies(ctx.Request(), language, plugin.InstallDependenciesRequest{
		Info:                    info,
		UseLanguageVersionTools: false,
		IsPlugin:                true,
	}, stdout, stderr)
	if err != nil {
		return fmt.Errorf("installing dependencies: %w", err)
	}

	return nil
}

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Run `pulumi plugin install language <name> <version>` (or a plain `pulumi install`/`pulumi up` once) so the language plugin is present locally.
  2. Inspect the wrapped error (`%w` cause) for the actual plugin issue — check ~/.pulumi/plugins for corrupt entries and delete the offending plugin directory.
  3. Verify the runtime name in the policy/project Pulumi.yaml matches a supported runtime (nodejs, python, dotnet, go, yaml, java).
  4. Check network/proxy access if the plugin needs to be downloaded, and confirm PULUMI_PLUGIN_DOWNLOAD_URLS / proxy env vars are correct.

Example fix

// before (PulumiPolicy.yaml)
runtime: nodejs18x

// after
runtime: nodejs
Defensive patterns

Strategy: validation

Validate before calling

// before publishing a policy pack, ensure the language plugin is installed
name := proj.Runtime.Name()
out, err := exec.Command("pulumi", "plugin", "ls").Output()
if err != nil || !strings.Contains(string(out), "language"+" "+name) {
    return fmt.Errorf("language plugin %q not installed; run: pulumi plugin install language %s", name, name)
}

Try / catch

if err := installRequiredPolicy(ctx, proj); err != nil {
    var cause error
    errors.As(err, &cause) // unwrap: root cause names the plugin problem
    log.Printf("policy pack language plugin load failed: %v", err)
}

Prevention

When it happens

Trigger: Calling backend Install (which calls installRequiredPolicy) when proj.Runtime.Name() references a runtime for which no language plugin is installed or downloadable, or when the plugin host fails to start the runtime.

Common situations: Policies defined with a runtime whose plugin version isn't installed locally; a corrupted ~/.pulumi/plugins cache; offline environments that can't download the plugin; a typo'd or unsupported runtime name in Pulumi.yaml (or policy PulumiPolicy.yaml).

Related errors


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