GoogleContainerTools/skaffold · warning

unable to generate skaffold config file automatically - try

Error message

unable to generate skaffold config file automatically - try running `skaffold init`: action cancelled by user

What it means

The automatic config generation was aborted because the user cancelled the interactive `initializer.Transparent` prompts (returned nil config). Skaffold reports that no config could be generated and suggests `skaffold init`.

Source

Thrown at cmd/skaffold/app/cmd/runner.go:122

	return runCtx, configs, nil
}

// withFallbackConfig will try to automatically generate a config if root `skaffold.yaml` file does not exist.
func withFallbackConfig(ctx context.Context, out io.Writer, opts config.SkaffoldOptions, getCfgs func(context.Context, config.SkaffoldOptions) (parser.SkaffoldConfigSet, error)) (parser.SkaffoldConfigSet, error) {
	configs, err := getCfgs(ctx, opts)
	if err == nil {
		return configs, nil
	}
	var e sErrors.Error
	if errors.As(err, &e) && e.StatusCode() == proto.StatusCode_CONFIG_FILE_NOT_FOUND_ERR {
		if (opts.AutoCreateConfig || opts.AutoInit) && initializer.ValidCmd(opts) {
			output.Default.Fprintf(out, "Skaffold config file %s not found - Trying to create one for you...\n", opts.ConfigurationFile)
			config, err := initializer.Transparent(context.Background(), out, initConfig.Config{Opts: opts, EnableManifestGeneration: opts.AutoInit})
			if err != nil {
				return nil, fmt.Errorf("unable to generate skaffold config file automatically - try running `skaffold init`: %w", err)
			}
			if config == nil {
				return nil, fmt.Errorf("unable to generate skaffold config file automatically - try running `skaffold init`: action cancelled by user")
			}

			defaults.Set(config)

			return parser.SkaffoldConfigSet{
				&parser.SkaffoldConfigEntry{SkaffoldConfig: config, IsRootConfig: true},
			}, nil
		}

		return nil, fmt.Errorf("skaffold config file %s not found - check your current working directory, or try running `skaffold init`", opts.ConfigurationFile)
	}

	// If the error is NOT that the file doesn't exist, then we warn the user
	// that maybe they are using an outdated version of Skaffold that's unable to read
	// the configuration.
	warnIfUpdateIsAvailable()
	return nil, fmt.Errorf("parsing skaffold config: %w", err)
}

View on GitHub (pinned to a1189de023)

Solutions

  1. Run `skaffold init` interactively and complete the prompts to create skaffold.yaml
  2. For non-interactive environments, provide skaffold.yaml ahead of time (commit it)
  3. Use skaffold init --force --skip-deployments or flags that skip interactive selection
  4. Set --auto-create-config=false if you intend to fail fast rather than prompt

Example fix

// CI environment, no interactive tty
// before: skaffold run (prompts cancelled)
// after
ci:
  - skaffold init --force && skaffold run
Defensive patterns

Strategy: fallback

Validate before calling

if [ ! -t 0 ]; then echo 'non-interactive shell: interactive init prompts will be cancelled - provide skaffold.yaml'; fi

Try / catch

config, err := initializer.Transparent(ctx, out, cfg)
if err == nil && config == nil {
	// user cancelled: fall back to instructing manual init
	return errors.New("config generation cancelled; run `skaffold init` to complete setup")
}

Prevention

When it happens

Trigger: Running a command in a directory without skaffold.yaml with auto-creation enabled, and answering negatively (or declining) to the interactive generation prompts, so Transparent returns nil.

Common situations: Running skaffold in CI where stdin is unavailable/prompts auto-cancel; user answers 'no' to artifact selection prompts; non-interactive terminal aborting the survey.

Related errors


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