GoogleContainerTools/skaffold · error
opening config file: %w
Error message
opening config file: %w
What it means
ParseKubernetesObjects opens the YAML file given to it and wraps any os.Open failure in 'opening config file: %w'. It means the file path handed to Skaffold (e.g. a manifest in skaffold.yaml or a validate/transform input) could not be opened — typically it does not exist or is not readable.
Source
Thrown at pkg/skaffold/kubernetes/util.go:84
return nil, err
}
var images []string
for _, k8sObject := range k8sObjects {
images = append(images, parseImagesFromYaml(k8sObject)...)
}
return images, nil
}
// ParseKubernetesObjects uses required fields from the k8s spec
// to determine if a provided yaml file is a valid k8s manifest, as detailed in
// https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields.
// If so, it will return the parsed objects.
func ParseKubernetesObjects(filepath string) ([]yamlObject, error) {
f, err := os.Open(filepath)
if err != nil {
return nil, fmt.Errorf("opening config file: %w", err)
}
defer f.Close()
r := k8syaml.NewYAMLReader(bufio.NewReader(f))
var k8sObjects []yamlObject
for {
doc, err := r.Read()
if err == io.EOF {
break
}
if err != nil {
return nil, fmt.Errorf("reading config file: %w", err)
}
obj := make(yamlObject)
if err := yaml.Unmarshal(doc, &obj); err != nil {View on GitHub (pinned to a1189de023)
Solutions
- Check the file exists: `ls -l <path>` for every path listed under manifests (or the path passed to the API)
- Fix the path in skaffold.yaml or pass an absolute path / run from the correct working directory
- If the file is generated by an earlier step, ensure that step runs and writes the file before this parse
- Verify read permissions on the file
Example fix
// before (skaffold.yaml) manifests: - k8s/deploymnet.yaml // after manifests: - k8s/deployment.yaml
Defensive patterns
Strategy: validation
Validate before calling
func validateManifestPaths(paths []string) error {
for _, p := range paths {
fi, err := os.Stat(p)
if err != nil {
return fmt.Errorf("manifest %s: %w", p, err)
}
if fi.IsDir() {
return fmt.Errorf("manifest %s is a directory, expected a file", p)
}
if fi.Mode()&0o400 == 0 {
return fmt.Errorf("manifest %s is not readable", p)
}
}
return nil
} Try / catch
objects, err := kubernetes.ParseKubernetesObjects(path)
if err != nil {
var pe *fs.PathError
if errors.As(err, &pe) && errors.Is(pe.Err, fs.ErrNotExist) {
log.Fatalf("manifest file missing: %s (check skaffold.yaml paths and cwd)", path)
}
return err
} Prevention
- Use absolute paths or always run skaffold from the project root
- Verify generated manifests exist before the deploy/validate stage
- Add a pre-flight check (ls/test -f) in CI before invoking skaffold
- Glob manifest paths intentionally and confirm expansion with `echo k8s/*.yaml`
When it happens
Trigger: Calling ParseKubernetesObjects (directly or via validateManifests, IsKubernetesManifest, ParseImagesFromKubernetesYaml) with a path that doesn't exist, is a directory, or lacks read permission; os.Open returns an error which is wrapped here.
Common situations: Typo in skaffold.yaml manifest paths; file generated by a prior build step was never produced; running skaffold from a different working directory with relative paths; file deleted between listing and parse.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- cannot resolve active Kubernetes context - multiple contexts
- reading config file: %w
- writing config file: %w
- could not read the hydrated manifest from %v: %w
- reading config file: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/314ea10b438c9d5e.
Report an issue: GitHub.