{"record":{"id":"48fa666b31758546","repo":"pulumi/pulumi","slug":"must-supply-s-unless-pulumi-is-run-interactivel","errorCode":null,"errorMessage":"Must supply <%s> unless pulumi is run interactively","messagePattern":"Must supply <(.+?)> unless pulumi is run interactively","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/state/io.go","lineNumber":384,"sourceCode":"func getNewResourceName() (string, error) {\n\tvar resourceName string\n\terr := survey.AskOne(&survey.Input{\n\t\tMessage: \"Choose a new resource name:\",\n\t}, &resourceName, ui.SurveyIcons(cmdutil.GetGlobalColorization()))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn resourceName, nil\n}\n\n// Format a non-nil error that indicates some arguments are missing for a\n// non-interactive session.\nfunc missingNonInteractiveArg(args ...string) error {\n\tswitch len(args) {\n\tcase 0:\n\t\tpanic(\"cannot create an error message for missing zero args\")\n\tcase 1:\n\t\treturn fmt.Errorf(\"Must supply <%s> unless pulumi is run interactively\", args[0])\n\tdefault:\n\t\tfor i, s := range args {\n\t\t\targs[i] = \"<\" + s + \">\"\n\t\t}\n\t\treturn fmt.Errorf(\"Must supply %s and %s unless pulumi is run interactively\",\n\t\t\tstrings.Join(args[:len(args)-1], \", \"), args[len(args)-1])\n\t}\n}\n","sourceCodeStart":366,"sourceCodeEnd":393,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/state/io.go#L366-L393","documentation":"missingNonInteractiveArg builds the error shown when a required CLI argument is absent in a non-interactive session. With exactly one missing argument it formats 'Must supply <arg> unless pulumi is run interactively', since the interactive prompt path cannot run without a TTY.","triggerScenarios":"Running state commands (e.g. `pulumi state delete` with no URN) in CI or piped stdin where cmdutil.Interactive() is false and the positional argument is empty.","commonSituations":"Automation scripts forgetting the URN argument; CI jobs invoking pulumi without a TTY so the interactive picker is skipped; shell variable expansions yielding an empty string argument.","solutions":["Pass the required argument explicitly (e.g. the full resource URN)","Run the command in an interactive terminal if you want the picker","Fix shell quoting/expansion so the argument is not empty in scripts"],"exampleFix":"// before (script, empty var)\npulumi state delete \"$URN\"\n// after: fail fast when the variable is unset\n: \"${URN:?URN is required}\" && pulumi state delete \"$URN\"","handlingStrategy":"validation","validationCode":"// shell: refuse to run when the required argument is missing\nif [ -z \"${URN:-}\" ]; then echo \"Must supply <urn> unless pulumi is run interactively\" >&2; exit 1; fi\npulumi state delete \"$URN\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["In scripts, assert required args are non-empty before invoking pulumi","Detect non-TTY environments and always pass explicit arguments","Use `${VAR:?}` expansions to fail fast on unset variables"],"tags":["cli","arguments","non-interactive"],"backgroundTag":"missing-required-argument","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}