{"record":{"id":"0c8665a7d970baf2","repo":"GoogleContainerTools/skaffold","slug":"reading-user-confirmation-w","errorCode":null,"errorMessage":"reading user confirmation: %w","messagePattern":"reading user confirmation: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/initializer/prompt/prompt.go","lineNumber":75,"sourceCode":"func WriteSkaffoldConfig(out io.Writer, pipeline []byte, generatedManifests map[string][]byte, filePath string) (bool, error) {\n\tfmt.Fprintln(out, string(pipeline))\n\n\tfor path, manifest := range generatedManifests {\n\t\tfmt.Fprintln(out, path, \"-\", string(manifest))\n\t}\n\n\tmanifestString := \"\"\n\tif len(generatedManifests) > 0 {\n\t\tmanifestString = \", along with the generated k8s manifests,\"\n\t}\n\n\tvar response bool\n\tprompt := &survey.Confirm{\n\t\tMessage: fmt.Sprintf(\"Do you want to write this configuration%s to %s?\", manifestString, filePath),\n\t}\n\terr := askOne(prompt, &response, nil)\n\tif err != nil {\n\t\treturn true, fmt.Errorf(\"reading user confirmation: %w\", err)\n\t}\n\n\treturn !response, nil\n}\n\n// chooseBuilders prompts the user to select which builders they'd like to create associated kubernetes manifests for\nfunc chooseBuilders(builders []string) ([]string, error) {\n\tchosen := []string{}\n\tprompt := &survey.MultiSelect{\n\t\tMessage: \"Which builders would you like to create kubernetes resources for?\",\n\t\tOptions: builders,\n\t}\n\terr := askOne(prompt, &chosen)\n\tif err != nil {\n\t\treturn []string{}, fmt.Errorf(\"getting user choices\")\n\t}\n\n\treturn chosen, err","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/initializer/prompt/prompt.go#L57-L93","documentation":"In interactive `skaffold init`, prompt.WriteSkaffoldConfig asks the user to confirm writing the configuration via a survey.Confirm prompt. If the interactive prompt itself fails (askOne error), the error is wrapped as 'reading user confirmation' and config writing is aborted. Note it returns (true, err) — true signals the caller should bail out.","triggerScenarios":"askOne(&survey.Confirm{...}) returns an error while DoInit/Transparent run interactively — typically no TTY/stdin attached, stdin closed, or a non-interactive CI environment running init without --force.","commonSituations":"Piping commands (cat x | skaffold init), CI runners without a TTY, running under ssh without -t, terminal that can't allocate the survey UI.","solutions":["Run skaffold init in an interactive terminal, or avoid the prompt with --force to skip confirmation","In CI, use skaffold init --force (and explicit --builder/--manifest flags) so no prompt is needed","Ensure stdin is a TTY: don't pipe into the command; use ssh -t for remote sessions"],"exampleFix":"// before (CI)\ncat pr.diff | skaffold init\n// after\nskaffold init --force --builder Dockerfile --manifest deploy/deployment.yaml","handlingStrategy":"try-catch","validationCode":"// skip the prompt path entirely in non-interactive environments:\nif !term.IsTerminal(int(os.Stdin.Fd())) {\n    return fmt.Errorf(\"non-interactive environment: use 'skaffold init --force' with explicit flags\")\n}","typeGuard":null,"tryCatchPattern":"if _, err := prompt.WriteSkaffoldConfig(out, cfg, manifests, path); err != nil {\n    if strings.Contains(err.Error(), \"reading user confirmation\") {\n        return fmt.Errorf(\"no TTY for confirmation; rerun with --force or in an interactive terminal: %w\", err)\n    }\n    return err\n}","preventionTips":["Never pipe stdin into skaffold init","In CI, always use --force (plus --builder/--manifest) so prompts never fire","Allocate a TTY for remote runs (ssh -t, docker -it)"],"tags":["init","interactive","prompt","stdin","ci"],"backgroundTag":"no-tty-interactive-prompt","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}