{"record":{"id":"aa5627c45aa5118c","repo":"GoogleContainerTools/skaffold","slug":"getting-user-choices","errorCode":null,"errorMessage":"getting user choices","messagePattern":"getting user choices","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/initializer/prompt/prompt.go","lineNumber":90,"sourceCode":"\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\n}\n\n// PortForwardResource prompts the user to give a port to forward the current resource on\nfunc portForwardResource(out io.Writer, imageName string) (int, error) {\n\tvar response string\n\tprompt := &survey.Question{\n\t\tPrompt: &survey.Input{Message: fmt.Sprintf(\"Select port to forward for %s (leave blank for none):\", imageName)},\n\t\tValidate: func(val interface{}) error {\n\t\t\tstr := val.(string)\n\t\t\tif _, err := strconv.Atoi(str); err != nil && str != \"\" {\n\t\t\t\treturn errors.New(\"response must be a number, or empty\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/initializer/prompt/prompt.go#L72-L108","documentation":"chooseBuilders shows a survey.MultiSelect asking which image builders should get Kubernetes resources during interactive init. If askOne fails, it returns an empty list wrapped as 'getting user choices' (note: the underlying error is discarded, making this one less debuggable). Any prompt failure aborts builder selection.","triggerScenarios":"askOne(&survey.MultiSelect{...}) errors while running interactive init — no TTY, stdin closed/eof, or terminal incompatibility with the survey library.","commonSituations":"CI/non-interactive shells triggering init prompts; ssh without pty; output redirected so the survey UI can't render; user aborts with Ctrl-C/EOF.","solutions":["Run init in an interactive TTY, or supply builder info non-interactively (--builder / auto-detection) so prompts are skipped","Use --force with explicit flags in CI to bypass all prompts","Check that stdin/stdout are real terminals; reattach with ssh -t"],"exampleFix":"// before\nssh server 'skaffold init'   # no pty\n// after\nssh -t server 'skaffold init'   # or: skaffold init --force","handlingStrategy":"fallback","validationCode":"if !term.IsTerminal(int(os.Stdin.Fd())) || !term.IsTerminal(int(os.Stdout.Fd())) {\n    return fmt.Errorf(\"interactive builder selection requires a TTY; use --builder instead\")\n}","typeGuard":null,"tryCatchPattern":"chosen, err := chooseBuilders(builders)\nif err != nil {\n    // the sentinel message hides the cause; fall back to non-interactive defaults\n    log.Printf(\"builder prompt unavailable (%v); defaulting to all detected builders\", err)\n    chosen = defaultBuilders\n}","preventionTips":["Prefer non-interactive init flags in automation (--builder, --force)","Run init in a real terminal with a capable TTY","Don't redirect init's stdout/stderr when prompts may appear"],"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"}