{"record":{"id":"cdd9673900eb4f82","repo":"GoogleContainerTools/skaffold","slug":"empty-file-found-at-path-s-verify-that-the-mani","errorCode":null,"errorMessage":"empty file found at path: %s, verify that the manifest path is correct","messagePattern":"empty file found at path: (.+?), verify that the manifest path is correct","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/k8sjob/util.go","lineNumber":86,"sourceCode":"\t}\n\treturn out, nil\n}\n\nfunc LoadFromPath(path string) (*batchv1.Job, error) {\n\tb, err := os.ReadFile(path)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Create a runtime.Decoder from the Codecs field within\n\t// k8s.io/client-go that's pre-loaded with the schemas for all\n\t// the standard Kubernetes resource types.\n\tdecoder := scheme.Codecs.UniversalDeserializer()\n\n\tresourceYAML := string(b)\n\tif len(resourceYAML) == 0 {\n\t\treturn nil, fmt.Errorf(\"empty file found at path: %s, verify that the manifest path is correct\", path)\n\t}\n\n\t// - obj is the API object (e.g., Job)\n\t// - groupVersionKind is a generic object that allows\n\t//   detecting the API type we are dealing with, for\n\t//   accurate type casting later.\n\tobj, groupVersionKind, err := decoder.Decode(\n\t\t[]byte(resourceYAML),\n\t\tnil,\n\t\tnil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Only process Jobs for now\n\tif groupVersionKind.Group != \"batch\" || groupVersionKind.Version != \"v1\" || groupVersionKind.Kind != \"Job\" {\n\t\treturn nil, fmt.Errorf(\"resource found in %s is not a k8s job, verify the manifest path is for a job resource\", path)\n\t}","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/k8sjob/util.go#L68-L104","documentation":"LoadFromPath reads a Kubernetes manifest file and refuses to proceed when the file contains no content. The library throws this so an empty or whitespace-only manifest path is caught early with a clear message instead of an opaque decoder error. It almost always means the configured manifest path is wrong.","triggerScenarios":"Calling LoadFromPath(path) where the file at path exists but is 0 bytes (or reads back empty), e.g. an empty file created by a failed template render or a touch'd placeholder.","commonSituations":"Skaffold config pointing at a manifest that was never rendered (Helm/Kustomize output empty), CI creating files with > redirect before writing, accidental `touch job.yaml`, wrong filename with a similarly-named empty file present.","solutions":["Check the file: `ls -la <path>` and `cat <path>` — fill it with a valid Job manifest","Fix the manifest path in your config to point at the real, non-empty file","If the manifest is generated, fix the generator (Helm/Kustomize) so it emits content and verify output before deploy","Delete stray empty files that shadow the real manifest"],"exampleFix":"// before\nkubectl apply -f job.yaml        # job.yaml is 0 bytes\n// after\nprintf 'apiVersion: batch/v1\\nkind: Job\\n...' > job.yaml\n# or correct the path in config:\n# manifests: [\"k8s/job.yaml\"]  (was: [\"k8s/empty.yaml\"])","handlingStrategy":"validation","validationCode":"info, err := os.Stat(path)\nif err != nil {\n    return fmt.Errorf(\"manifest missing: %w\", err)\n}\nb, _ := os.ReadFile(path)\nif len(bytes.TrimSpace(b)) == 0 {\n    return fmt.Errorf(\"manifest %s is empty\", path)\n}","typeGuard":null,"tryCatchPattern":"obj, err := k8sjob.LoadFromPath(path)\nif err != nil {\n    if strings.Contains(err.Error(), \"empty file found\") {\n        return fmt.Errorf(\"check manifest path %q: file is empty\", path)\n    }\n    return err\n}","preventionTips":["Validate generated manifests (helm template / kustomize build) are non-empty before deploy","Use lint (yamllint) on manifest files in CI","Avoid creating placeholder files with touch in manifest directories","Assert manifest file size > 0 in build scripts"],"tags":["kubernetes","manifest","validation"],"backgroundTag":"empty-manifest-file","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"}