{"record":{"id":"b763f3c089e9be2d","repo":"anomalyco/sst","slug":"errstackrunfailed","errorCode":"ErrStackRunFailed","errorMessage":"stack run had errors","messagePattern":"stack run had errors","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/project/stack.go","lineNumber":117,"sourceCode":"\tOld   interface{}\n\tNew   interface{}\n}\n\ntype StackCommandEvent struct {\n\tApp     string\n\tStage   string\n\tConfig  string\n\tCommand string\n\tVersion string\n}\n\ntype Error struct {\n\tMessage string   `json:\"message\"`\n\tURN     string   `json:\"urn\"`\n\tHelp    []string `json:\"help\"`\n}\n\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}","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/pkg/project/stack.go#L99-L135","documentation":"ErrStackRunFailed is the sentinel returned by Project.Run when the underlying Pulumi stack operation completed but reported errors (e.g. resource update failures captured in the completed event). It signals that the deployment ran but one or more resources failed, rather than a setup or configuration problem.","triggerScenarios":"Running `sst Run` (deploy/refresh/destroy) where Pulumi finishes with failed resource operations — returned at pkg/project/run.go:694 after the completed event indicates errors.","commonSituations":"Cloud provider rejects an operation (quota exceeded, permission denied, invalid property); drift or protected resources blocking replacement; a resource timed out during create/update; infrastructure errors from a prior partial deploy.","solutions":["Read the Pulumi logs written by the run (pulumi.out/pulumi.err via p.PathLog) to find the failing resource URN and its error message.","Fix the specific resource error (permissions, quota, invalid config) and re-run deploy — the update is resumable.","If a resource is stuck/protected, use `pulumi stack` tooling or adjust protections, then retry.","If caused by cloud-side drift, run a refresh before the next deploy to reconcile state."],"exampleFix":"// before\nif err := project.Run(ctx, input); err != nil {\n\tlog.Fatal(err) // \"stack run had errors\" with no detail\n}\n\n// after\nif err := project.Run(ctx, input); err != nil {\n\tif errors.Is(err, stack.ErrStackRunFailed) {\n\t\tlog.Fatalf(\"stack run failed; see %s for per-resource errors\", p.PathLog(\"pulumi.out\"))\n\t}\n\tlog.Fatal(err)\n}","handlingStrategy":"try-catch","validationCode":"// Pre-validate cloud credentials and config before the run:\nif os.Getenv(\"AWS_ACCESS_KEY_ID\") == \"\" {\n\treturn fmt.Errorf(\"cloud credentials missing; stack run would fail\")\n}","typeGuard":null,"tryCatchPattern":"err := project.Run(ctx, input)\nif errors.Is(err, stack.ErrStackRunFailed) {\n\tperResource := readPulumiLog(p.PathLog(\"pulumi.out\"))\n\tlog.Error(\"stack run had errors\", \"details\", perResource)\n\treturn fmt.Errorf(\"stack run failed: %w\", err)\n}","preventionTips":["Run `diff` before deploy in CI to catch destructive/invalid changes early.","Keep Pulumi stdout/stderr logs (p.PathLog) and surface them on failure.","Pre-check IAM permissions and service quotas for resources you provision.","Run periodic refresh to reduce drift-induced update failures."],"tags":["pulumi","deployment","infrastructure","sentinel-error"],"backgroundTag":"stack-deployment-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}