{"record":{"id":"19d16f0f20a83976","repo":"pulumi/pulumi","slug":"skip-preview-and-preview-only-cannot-be-used-t","errorCode":null,"errorMessage":"--skip-preview and --preview-only cannot be used together","messagePattern":"--skip-preview and --preview-only cannot be used together","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/operations/io.go","lineNumber":106,"sourceCode":"\t\treturn nil, \"\", oerr\n\t}\n\tif clientAddress != \"\" {\n\t\tproj.Runtime = workspace.NewProjectRuntimeInfo(\"client\", map[string]any{\n\t\t\t\"address\": clientAddress,\n\t\t})\n\t}\n\treturn proj, root, nil\n}\n\n// updateFlagsToOptions ensures that the given update flags represent a valid combination.  If so, an UpdateOptions\n// is returned with a nil-error; otherwise, the non-nil error contains information about why the combination is invalid.\nfunc updateFlagsToOptions(interactive, skipPreview, yes, previewOnly bool) (backend.UpdateOptions, error) {\n\tswitch {\n\tcase !interactive && !yes && !skipPreview && !previewOnly:\n\t\treturn backend.UpdateOptions{}, backenderr.NoConfirmationInNonInteractiveError{}\n\tcase skipPreview && previewOnly:\n\t\treturn backend.UpdateOptions{},\n\t\t\terrors.New(\"--skip-preview and --preview-only cannot be used together\")\n\tcase yes && previewOnly:\n\t\treturn backend.UpdateOptions{},\n\t\t\terrors.New(\"--yes and --preview-only cannot be used together\")\n\tdefault:\n\t\treturn backend.UpdateOptions{\n\t\t\tAutoApprove: yes,\n\t\t\tSkipPreview: skipPreview,\n\t\t\tPreviewOnly: previewOnly,\n\t\t}, nil\n\t}\n}\n\nfunc getRefreshOption(proj *workspace.Project, refresh string) (bool, error) {\n\t// we want to check for an explicit --refresh or a --refresh=true or --refresh=false\n\t// refresh is assigned the empty string by default to distinguish the difference between\n\t// when the user actually interacted with the cli argument (`NoOptDefVal`)\n\t// and the default functionality today\n\tif refresh != \"\" {","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/operations/io.go#L88-L124","documentation":"`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.","triggerScenarios":"Running `pulumi up --skip-preview --preview-only` (or destroy/refresh equivalents) in non-interactive mode where both flags are set.","commonSituations":"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.","solutions":["Remove one of the two flags — keep `--preview-only` if you only want to see the plan, or `--skip-preview` to run without one","Audit CI scripts for flag accumulation (e.g. FLAGS=\"$FLAGS --skip-preview\" alongside --preview-only)","Use `pulumi preview` separately if you want an isolated preview without the contradictory flags"],"exampleFix":"// before\npulumi up --skip-preview --preview-only\n// after\npulumi up --preview-only   # or: pulumi up --skip-preview","handlingStrategy":"validation","validationCode":"// shell guard before invoking CLI\nif echo \"$FLAGS\" | grep -q -- '--skip-preview' && echo \"$FLAGS\" | grep -q -- '--preview-only'; then\n  echo \"--skip-preview and --preview-only cannot be used together\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In CI scripts, build flag strings from a single source of truth","Prefer `pulumi preview` as a standalone step instead of --preview-only","Document flag semantics in wrapper scripts to avoid stacking contradictory options"],"tags":["cli","flags","validation","update"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}