anomalyco/sst · error

ErrStackRunFailed

ErrStackRunFailed

Error message

stack run had errors

What it means

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.

Source

Thrown at pkg/project/stack.go:117

	Old   interface{}
	New   interface{}
}

type StackCommandEvent struct {
	App     string
	Stage   string
	Config  string
	Command string
	Version string
}

type Error struct {
	Message string   `json:"message"`
	URN     string   `json:"urn"`
	Help    []string `json:"help"`
}

var ErrStackRunFailed = fmt.Errorf("stack run had errors")
var ErrStageNotFound = fmt.Errorf("stage not found")
var ErrPassphraseInvalid = fmt.Errorf("passphrase invalid")
var ErrProtectedStage = fmt.Errorf("cannot remove protected stage")
var ErrProtectedDevStage = fmt.Errorf("cannot run sst dev on protected stage")
var ErrPolicyViolation = fmt.Errorf("policy violations detected")
var ErrPolicyConfigError = fmt.Errorf("policy configuration error")

func (p *Project) ResolvePolicyPackPath(policyPath string) (string, error) {
	var resolvedPath string
	if filepath.IsAbs(policyPath) {
		resolvedPath = policyPath
	} else {
		resolvedPath = filepath.Join(p.PathRoot(), policyPath)
	}

	if _, err := os.Stat(resolvedPath); err != nil {
		return "", fmt.Errorf("Policy pack not found in path: %v", resolvedPath)
	}

View on GitHub (pinned to a0bd20f762)

Solutions

  1. 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.
  2. Fix the specific resource error (permissions, quota, invalid config) and re-run deploy — the update is resumable.
  3. If a resource is stuck/protected, use `pulumi stack` tooling or adjust protections, then retry.
  4. If caused by cloud-side drift, run a refresh before the next deploy to reconcile state.

Example fix

// before
if err := project.Run(ctx, input); err != nil {
	log.Fatal(err) // "stack run had errors" with no detail
}

// after
if err := project.Run(ctx, input); err != nil {
	if errors.Is(err, stack.ErrStackRunFailed) {
		log.Fatalf("stack run failed; see %s for per-resource errors", p.PathLog("pulumi.out"))
	}
	log.Fatal(err)
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate cloud credentials and config before the run:
if os.Getenv("AWS_ACCESS_KEY_ID") == "" {
	return fmt.Errorf("cloud credentials missing; stack run would fail")
}

Try / catch

err := project.Run(ctx, input)
if errors.Is(err, stack.ErrStackRunFailed) {
	perResource := readPulumiLog(p.PathLog("pulumi.out"))
	log.Error("stack run had errors", "details", perResource)
	return fmt.Errorf("stack run failed: %w", err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30). Data as JSON: /api/errors/b763f3c089e9be2d. Report an issue: GitHub.