pulumi/pulumi · error

--skip-preview and --preview-only cannot be used together

Error message

--skip-preview and --preview-only cannot be used together

What it means

`updateFlagsToOptions` converts CLI flags into backend UpdateOptions and rejects contradictory flag combinations. `--skip-preview` (run without a preview) and `--preview-only` (run only the preview) are mutually exclusive, so passing both returns this error before any update starts.

Source

Thrown at pkg/cmd/pulumi/operations/io.go:106

		return nil, "", oerr
	}
	if clientAddress != "" {
		proj.Runtime = workspace.NewProjectRuntimeInfo("client", map[string]any{
			"address": clientAddress,
		})
	}
	return proj, root, nil
}

// updateFlagsToOptions ensures that the given update flags represent a valid combination.  If so, an UpdateOptions
// is returned with a nil-error; otherwise, the non-nil error contains information about why the combination is invalid.
func updateFlagsToOptions(interactive, skipPreview, yes, previewOnly bool) (backend.UpdateOptions, error) {
	switch {
	case !interactive && !yes && !skipPreview && !previewOnly:
		return backend.UpdateOptions{}, backenderr.NoConfirmationInNonInteractiveError{}
	case skipPreview && previewOnly:
		return backend.UpdateOptions{},
			errors.New("--skip-preview and --preview-only cannot be used together")
	case yes && previewOnly:
		return backend.UpdateOptions{},
			errors.New("--yes and --preview-only cannot be used together")
	default:
		return backend.UpdateOptions{
			AutoApprove: yes,
			SkipPreview: skipPreview,
			PreviewOnly: previewOnly,
		}, nil
	}
}

func getRefreshOption(proj *workspace.Project, refresh string) (bool, error) {
	// we want to check for an explicit --refresh or a --refresh=true or --refresh=false
	// refresh is assigned the empty string by default to distinguish the difference between
	// when the user actually interacted with the cli argument (`NoOptDefVal`)
	// and the default functionality today
	if refresh != "" {

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Remove one of the two flags — keep `--preview-only` if you only want to see the plan, or `--skip-preview` to run without one
  2. Audit CI scripts for flag accumulation (e.g. FLAGS="$FLAGS --skip-preview" alongside --preview-only)
  3. Use `pulumi preview` separately if you want an isolated preview without the contradictory flags

Example fix

// before
pulumi up --skip-preview --preview-only
// after
pulumi up --preview-only   # or: pulumi up --skip-preview
Defensive patterns

Strategy: validation

Validate before calling

// shell guard before invoking CLI
if echo "$FLAGS" | grep -q -- '--skip-preview' && echo "$FLAGS" | grep -q -- '--preview-only'; then
  echo "--skip-preview and --preview-only cannot be used together"; exit 1
fi

Prevention

When it happens

Trigger: Running `pulumi up --skip-preview --preview-only` (or destroy/refresh equivalents) in non-interactive mode where both flags are set.

Common situations: Shell scripts/CI pipelines with accumulated flag variables where both flags get set; aliases or wrapper scripts that hardcode one flag while the user adds the other on the command line.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/19d16f0f20a83976. Report an issue: GitHub.