{"record":{"id":"633390dc2b28c93a","repo":"pulumi/pulumi","slug":"failed-to-load-pulumi-policy-project-located-at-q-633390","errorCode":null,"errorMessage":"failed to load Pulumi policy project located at %q: %w","messagePattern":"failed to load Pulumi policy project located at %q: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/go/common/resource/plugin/analyzer_plugin.go","lineNumber":112,"sourceCode":"\n\treturn &analyzer{\n\t\tname:   name,\n\t\tplug:   plug,\n\t\tclient: pulumirpc.NewAnalyzerClient(plug.Conn),\n\t}, nil\n}\n\n// NewPolicyAnalyzer boots the analyzer plugin located at `policyPackpath`. `hasPlugin` is a function that allows the\n// caller to configure how it is determined if the language plugin is available. If nil it will default to looking for\n// the plugin by path.\nfunc NewPolicyAnalyzer(\n\thost Host, ctx *Context, name tokens.QName, policyPackPath string, opts *PolicyAnalyzerOptions,\n\thasPlugin func(workspace.PluginDescriptor) bool,\n) (Analyzer, error) {\n\tprojPath := filepath.Join(policyPackPath, \"PulumiPolicy.yaml\")\n\tproj, err := workspace.LoadPolicyPack(projPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load Pulumi policy project located at %q: %w\", policyPackPath, err)\n\t}\n\n\thandshake := func(\n\t\tctx context.Context, bin string, prefix string, conn *grpc.ClientConn,\n\t) (*pulumirpc.AnalyzerHandshakeResponse, error) {\n\t\t// For analyzers the root directory and program directory are the location of the PulumiPolicy.yaml _not_ the\n\t\t// location of the shim plugin.\n\t\tdir := policyPackPath\n\t\tclient := pulumirpc.NewAnalyzerClient(conn)\n\n\t\treq := pulumirpc.AnalyzerHandshakeRequest{\n\t\t\tEngineAddress:    host.ServerAddr(),\n\t\t\tRootDirectory:    &dir,\n\t\t\tProgramDirectory: &dir,\n\t\t}\n\n\t\tres, err := client.Handshake(ctx, &req)\n\t\tif err != nil {","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/go/common/resource/plugin/analyzer_plugin.go#L94-L130","documentation":"When launching a policy analyzer plugin, the PulumiPolicy.yaml in the given policy pack directory is loaded first. If loading that project file fails (missing file, invalid YAML, schema violation), the error is wrapped with the pack path.","triggerScenarios":"Calling NewPolicyAnalyzer (or NewAnalyzer with a policyPackPath) where <policyPackPath>/PulumiPolicy.yaml does not exist or fails workspace.LoadPolicyPack validation.","commonSituations":"Running pulumi up with --policy-pack pointing at a directory that is not a policy pack; typo'd path; PulumiPolicy.yaml renamed or malformed after editing.","solutions":["Verify the path points to a directory containing a valid PulumiPolicy.yaml","Validate the YAML syntax and required fields (runtime, etc.) in PulumiPolicy.yaml","Re-create or re-checkout the policy pack if the file was deleted"],"exampleFix":"// before\npulumi up --policy-pack ./not-a-pack\n// after\ncd ./my-policy-pack && ls PulumiPolicy.yaml && pulumi up --policy-pack .","handlingStrategy":"validation","validationCode":"projPath := filepath.Join(packDir, \"PulumiPolicy.yaml\")\nif _, err := os.Stat(projPath); err != nil {\n    return fmt.Errorf(\"%s is not a policy pack: missing PulumiPolicy.yaml\", packDir)\n}","typeGuard":"null","tryCatchPattern":"analyzer, err := plugin.NewPolicyAnalyzer(host, ctx, name, packPath, opts, hasPlugin)\nif err != nil {\n    if strings.Contains(err.Error(), \"failed to load Pulumi policy project\") {\n        // check PulumiPolicy.yaml exists and is valid YAML\n    }\n}","preventionTips":["Always point --policy-pack at a directory containing PulumiPolicy.yaml","Lint/validate PulumiPolicy.yaml after edits","Commit PulumiPolicy.yaml so checkouts are complete"],"tags":["go","policy","plugin","config"],"backgroundTag":"policy-project-load-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}