{"record":{"id":"314ea10b438c9d5e","repo":"GoogleContainerTools/skaffold","slug":"opening-config-file-w","errorCode":null,"errorMessage":"opening config file: %w","messagePattern":"opening config file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/kubernetes/util.go","lineNumber":84,"sourceCode":"\t\treturn nil, err\n\t}\n\n\tvar images []string\n\tfor _, k8sObject := range k8sObjects {\n\t\timages = append(images, parseImagesFromYaml(k8sObject)...)\n\t}\n\n\treturn images, nil\n}\n\n// ParseKubernetesObjects uses required fields from the k8s spec\n// to determine if a provided yaml file is a valid k8s manifest, as detailed in\n// https://kubernetes.io/docs/concepts/overview/working-with-objects/kubernetes-objects/#required-fields.\n// If so, it will return the parsed objects.\nfunc ParseKubernetesObjects(filepath string) ([]yamlObject, error) {\n\tf, err := os.Open(filepath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"opening config file: %w\", err)\n\t}\n\tdefer f.Close()\n\n\tr := k8syaml.NewYAMLReader(bufio.NewReader(f))\n\n\tvar k8sObjects []yamlObject\n\n\tfor {\n\t\tdoc, err := r.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"reading config file: %w\", err)\n\t\t}\n\n\t\tobj := make(yamlObject)\n\t\tif err := yaml.Unmarshal(doc, &obj); err != nil {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/kubernetes/util.go#L66-L102","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before (skaffold.yaml)\nmanifests:\n  - k8s/deploymnet.yaml\n// after\nmanifests:\n  - k8s/deployment.yaml","handlingStrategy":"validation","validationCode":"func validateManifestPaths(paths []string) error {\n    for _, p := range paths {\n        fi, err := os.Stat(p)\n        if err != nil {\n            return fmt.Errorf(\"manifest %s: %w\", p, err)\n        }\n        if fi.IsDir() {\n            return fmt.Errorf(\"manifest %s is a directory, expected a file\", p)\n        }\n        if fi.Mode()&0o400 == 0 {\n            return fmt.Errorf(\"manifest %s is not readable\", p)\n        }\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"objects, err := kubernetes.ParseKubernetesObjects(path)\nif err != nil {\n    var pe *fs.PathError\n    if errors.As(err, &pe) && errors.Is(pe.Err, fs.ErrNotExist) {\n        log.Fatalf(\"manifest file missing: %s (check skaffold.yaml paths and cwd)\", path)\n    }\n    return err\n}","preventionTips":["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`"],"tags":["kubernetes","file-io","config"],"backgroundTag":"file-not-found","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"}