{"record":{"id":"d87cef4f780943e1","repo":"pulumi/pulumi","slug":"failed-to-load-language-plugin-s-w","errorCode":null,"errorMessage":"failed to load language plugin %s: %w","messagePattern":"failed to load language plugin (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/backend/httpstate/policypack.go","lineNumber":563,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load policy project at %s: %w\", finalDir, err)\n\t}\n\n\t// Workaround for python, some policy packs don't specify a venv but we want to use one\n\tif proj.Runtime.Name() == \"python\" {\n\t\t// If the policy's options provide a virtualenv use it, else default to \"venv\"\n\t\tif _, has := proj.Runtime.Options()[\"virtualenv\"]; !has {\n\t\t\tproj.Runtime.SetOption(\"virtualenv\", \"venv\")\n\t\t\terr = proj.Save(projPath)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to save policy project at %s: %w\", finalDir, err)\n\t\t\t}\n\t\t}\n\t}\n\n\tlanguage, err := ctx.Host.LanguageRuntime(ctx, proj.Runtime.Name())\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to load language plugin %s: %w\", proj.Runtime.Name(), err)\n\t}\n\n\tinfo := plugin.NewProgramInfo(finalDir, finalDir, \".\", proj.Runtime.Options())\n\terr = pkgCmdUtil.InstallDependencies(ctx.Request(), language, plugin.InstallDependenciesRequest{\n\t\tInfo:                    info,\n\t\tUseLanguageVersionTools: false,\n\t\tIsPlugin:                true,\n\t}, stdout, stderr)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"installing dependencies: %w\", err)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":545,"sourceCodeEnd":578,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/backend/httpstate/policypack.go#L545-L578","documentation":"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).","triggerScenarios":"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.","commonSituations":"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).","solutions":["Run `pulumi plugin install language <name> <version>` (or a plain `pulumi install`/`pulumi up` once) so the language plugin is present locally.","Inspect the wrapped error (`%w` cause) for the actual plugin issue — check ~/.pulumi/plugins for corrupt entries and delete the offending plugin directory.","Verify the runtime name in the policy/project Pulumi.yaml matches a supported runtime (nodejs, python, dotnet, go, yaml, java).","Check network/proxy access if the plugin needs to be downloaded, and confirm PULUMI_PLUGIN_DOWNLOAD_URLS / proxy env vars are correct."],"exampleFix":"// before (PulumiPolicy.yaml)\nruntime: nodejs18x\n\n// after\nruntime: nodejs","handlingStrategy":"validation","validationCode":"// before publishing a policy pack, ensure the language plugin is installed\nname := proj.Runtime.Name()\nout, err := exec.Command(\"pulumi\", \"plugin\", \"ls\").Output()\nif err != nil || !strings.Contains(string(out), \"language\"+\" \"+name) {\n    return fmt.Errorf(\"language plugin %q not installed; run: pulumi plugin install language %s\", name, name)\n}","typeGuard":null,"tryCatchPattern":"if err := installRequiredPolicy(ctx, proj); err != nil {\n    var cause error\n    errors.As(err, &cause) // unwrap: root cause names the plugin problem\n    log.Printf(\"policy pack language plugin load failed: %v\", err)\n}","preventionTips":["Run `pulumi install` in CI before publishing policy packs so plugins are cached.","Keep runtime names in PulumiPolicy.yaml canonical (nodejs, python) — not versioned variants.","Monitor ~/.pulumi/plugins for corrupt plugin directories after failed upgrades.","Pre-download plugins in air-gapped environments using the plugin download mirror."],"tags":["pulumi","plugins","policy-pack","language-runtime"],"backgroundTag":"language-plugin-load-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-09-01T08:17:40.651Z"}