{"record":{"id":"0564b8e2424d097b","repo":"anomalyco/sst","slug":"policy-pack-not-found-in-path-v","errorCode":null,"errorMessage":"Policy pack not found in path: %v","messagePattern":"Policy pack not found in path: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/project/stack.go","lineNumber":134,"sourceCode":"\nvar ErrStackRunFailed = fmt.Errorf(\"stack run had errors\")\nvar ErrStageNotFound = fmt.Errorf(\"stage not found\")\nvar ErrPassphraseInvalid = fmt.Errorf(\"passphrase invalid\")\nvar ErrProtectedStage = fmt.Errorf(\"cannot remove protected stage\")\nvar ErrProtectedDevStage = fmt.Errorf(\"cannot run sst dev on protected stage\")\nvar ErrPolicyViolation = fmt.Errorf(\"policy violations detected\")\nvar ErrPolicyConfigError = fmt.Errorf(\"policy configuration error\")\n\nfunc (p *Project) ResolvePolicyPackPath(policyPath string) (string, error) {\n\tvar resolvedPath string\n\tif filepath.IsAbs(policyPath) {\n\t\tresolvedPath = policyPath\n\t} else {\n\t\tresolvedPath = filepath.Join(p.PathRoot(), policyPath)\n\t}\n\n\tif _, err := os.Stat(resolvedPath); err != nil {\n\t\treturn \"\", fmt.Errorf(\"Policy pack not found in path: %v\", resolvedPath)\n\t}\n\n\treturn resolvedPath, nil\n}\n\nfunc (p *Project) Lock(command string) (*provider.Update, error) {\n\treturn provider.Lock(p.home, p.Version(), command, p.app.Name, p.app.Stage)\n}\n\nfunc (s *Project) Unlock() error {\n\treturn provider.Unlock(s.home, s.version, s.app.Name, s.app.Stage)\n}\n\nfunc (s *Project) ForceUnlock() error {\n\treturn provider.ForceUnlock(s.home, s.version, s.app.Name, s.app.Stage)\n}\n\nfunc getNotNilFields(v interface{}) []interface{} {","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/project/stack.go#L116-L152","documentation":"ResolvePolicyPackPath wraps os.Stat failures into the message \"Policy pack not found in path: <resolvedPath>\". It is raised when the policy pack supplied to the run cannot be found on the filesystem after path resolution: absolute paths are used verbatim, relative paths are joined against the project root (p.PathRoot()).","triggerScenarios":"Project.Run passes input.PolicyPath to ResolvePolicyPackPath; os.Stat(resolvedPath) returns an error because the directory does not exist or is inaccessible (pkg/project/stack.go:133-135). Triggered by `sst deploy/remove --policy-path <bad path>` or a policyPath set in the StackInput.","commonSituations":"Typo in the policy path; pack lives outside the repo while a relative path was given; running the CLI from a checkout where the policies folder was never committed (gitignored); permissions issue after cloning as another user.","solutions":["Pass an absolute path to --policy-path to bypass project-root joining, or fix the relative path so it resolves under the project root.","Create/restore the policy pack directory at the expected location (e.g. copy it in or un-gitignore it) and verify with `ls <resolved path>`.","Check file permissions on the pack directory so the user running sst can stat/read it.","Remove the --policy-path flag if no policy enforcement is intended for this run."],"exampleFix":"// before\npolicyPath = \"pack\"            // resolves to <projectRoot>/pack, which doesn't exist\n// after\npolicyPath = \"/abs/path/to/policies/pack\" // absolute, verified to exist","handlingStrategy":"try-catch","validationCode":"// Go: validate the policy path exactly as ResolvePolicyPackPath does, before calling Run\nresolved := policyPath\nif !filepath.IsAbs(resolved) {\n    resolved = filepath.Join(projectRoot, resolved)\n}\nif _, err := os.Stat(resolved); err != nil {\n    return fmt.Errorf(\"policy pack not found: %s\", resolved)\n}","typeGuard":null,"tryCatchPattern":"resolvedPath, err := p.ResolvePolicyPackPath(input.PolicyPath)\nif err != nil {\n    // message includes the resolved path that was not found\n    return fmt.Errorf(\"fix --policy-path: %w\", err)\n}\ninput.PolicyPath = resolvedPath\nreturn p.Run(ctx, input)","preventionTips":["Always resolve and os.Stat the policy path in scripts before invoking sst.","Prefer absolute paths for policy packs in CI; keep them outside the repo only when the CI fetches them reliably.","Do not gitignore the policies folder used by local runs.","Use consistent project-root detection (run sst from the repo root or set the root explicitly)."],"tags":["sst","policy","path-resolution","configuration"],"backgroundTag":"policy-pack-not-found","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}