GoogleContainerTools/skaffold · critical

read skaffold config: %w

Error message

read skaffold config: %w

What it means

ParseConfig wraps any failure to physically read the skaffold configuration file with this message. It is a generic wrapper (%w) around errors from misc.ReadConfiguration, so the underlying cause (missing file, permission denied, IO error) is chained after 'read skaffold config:'.

Source

Thrown at pkg/skaffold/schema/versions.go:231

		}
	}

	return nil, false
}

// IsSkaffoldConfig is for determining if a file is skaffold config file.
func IsSkaffoldConfig(file string) bool {
	if config, err := ParseConfig(file); err == nil && config != nil {
		return true
	}
	return false
}

// ParseConfig reads a configuration file.
func ParseConfig(filename string) ([]util.VersionedConfig, error) {
	buf, err := misc.ReadConfiguration(filename)
	if err != nil {
		return nil, fmt.Errorf("read skaffold config: %w", err)
	}
	factories, err := configFactoryFromAPIVersion(buf)
	if err != nil {
		return nil, err
	}
	buf, err = removeYamlAnchors(buf)
	if err != nil {
		return nil, fmt.Errorf("unable to re-marshal YAML without dotted keys: %w", err)
	}
	return parseConfig(buf, factories)
}

// ParseConfigAndUpgrade reads a configuration file and upgrades it to a given version.
func ParseConfigAndUpgrade(filename string) ([]util.VersionedConfig, error) {
	configs, err := ParseConfig(filename)
	if err != nil {
		return nil, err
	}

View on GitHub (pinned to a1189de023)

Solutions

  1. Verify the file exists at the given path (ls / test -f)
  2. Run the command from the directory containing skaffold.yaml or pass the correct --filename
  3. Fix file permissions if the file exists but is unreadable
  4. Inspect the wrapped cause (%w) for the exact OS error

Example fix

// before
configs, err := schema.ParseConfig(cfgPath)
// after
if _, statErr := os.Stat(cfgPath); statErr != nil {
	return fmt.Errorf("skaffold config %q not found: %w", cfgPath, statErr)
}
configs, err := schema.ParseConfig(cfgPath)
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := os.Stat(cfgPath); err != nil {
	return fmt.Errorf("cannot access skaffold config %q: %w", cfgPath, err)
}

Try / catch

configs, err := schema.ParseConfig(cfgPath)
if err != nil {
	if errors.Is(err, os.ErrNotExist) || errors.Is(err, os.ErrPermission) {
		// resolve path/permissions before retrying
	}
	return fmt.Errorf("load config: %w", err)
}

Prevention

When it happens

Trigger: Calling skaffold.ParseConfig(filename) when the file does not exist, is a directory, or the process lacks read permission on it.

Common situations: Running skaffold from a directory without skaffold.yaml; wrong --filename path; permissions changed after checkout; CI checkout missing the config file.

Understand the failure class

Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.

Related errors


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