GoogleContainerTools/skaffold · error

reading user confirmation: %w

Error message

reading user confirmation: %w

What it means

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.

Source

Thrown at pkg/skaffold/initializer/prompt/prompt.go:75

func WriteSkaffoldConfig(out io.Writer, pipeline []byte, generatedManifests map[string][]byte, filePath string) (bool, error) {
	fmt.Fprintln(out, string(pipeline))

	for path, manifest := range generatedManifests {
		fmt.Fprintln(out, path, "-", string(manifest))
	}

	manifestString := ""
	if len(generatedManifests) > 0 {
		manifestString = ", along with the generated k8s manifests,"
	}

	var response bool
	prompt := &survey.Confirm{
		Message: fmt.Sprintf("Do you want to write this configuration%s to %s?", manifestString, filePath),
	}
	err := askOne(prompt, &response, nil)
	if err != nil {
		return true, fmt.Errorf("reading user confirmation: %w", err)
	}

	return !response, nil
}

// chooseBuilders prompts the user to select which builders they'd like to create associated kubernetes manifests for
func chooseBuilders(builders []string) ([]string, error) {
	chosen := []string{}
	prompt := &survey.MultiSelect{
		Message: "Which builders would you like to create kubernetes resources for?",
		Options: builders,
	}
	err := askOne(prompt, &chosen)
	if err != nil {
		return []string{}, fmt.Errorf("getting user choices")
	}

	return chosen, err

View on GitHub (pinned to a1189de023)

Solutions

  1. Run skaffold init in an interactive terminal, or avoid the prompt with --force to skip confirmation
  2. In CI, use skaffold init --force (and explicit --builder/--manifest flags) so no prompt is needed
  3. Ensure stdin is a TTY: don't pipe into the command; use ssh -t for remote sessions

Example fix

// before (CI)
cat pr.diff | skaffold init
// after
skaffold init --force --builder Dockerfile --manifest deploy/deployment.yaml
Defensive patterns

Strategy: try-catch

Validate before calling

// skip the prompt path entirely in non-interactive environments:
if !term.IsTerminal(int(os.Stdin.Fd())) {
    return fmt.Errorf("non-interactive environment: use 'skaffold init --force' with explicit flags")
}

Try / catch

if _, err := prompt.WriteSkaffoldConfig(out, cfg, manifests, path); err != nil {
    if strings.Contains(err.Error(), "reading user confirmation") {
        return fmt.Errorf("no TTY for confirmation; rerun with --force or in an interactive terminal: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: Piping commands (cat x | skaffold init), CI runners without a TTY, running under ssh without -t, terminal that can't allocate the survey UI.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/0c8665a7d970baf2. Report an issue: GitHub.