GoogleContainerTools/skaffold · error

empty file found at path: %s, verify that the manifest path

Error message

empty file found at path: %s, verify that the manifest path is correct

What it means

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.

Source

Thrown at pkg/skaffold/k8sjob/util.go:86

	}
	return out, nil
}

func LoadFromPath(path string) (*batchv1.Job, error) {
	b, err := os.ReadFile(path)

	if err != nil {
		return nil, err
	}

	// Create a runtime.Decoder from the Codecs field within
	// k8s.io/client-go that's pre-loaded with the schemas for all
	// the standard Kubernetes resource types.
	decoder := scheme.Codecs.UniversalDeserializer()

	resourceYAML := string(b)
	if len(resourceYAML) == 0 {
		return nil, fmt.Errorf("empty file found at path: %s, verify that the manifest path is correct", path)
	}

	// - obj is the API object (e.g., Job)
	// - groupVersionKind is a generic object that allows
	//   detecting the API type we are dealing with, for
	//   accurate type casting later.
	obj, groupVersionKind, err := decoder.Decode(
		[]byte(resourceYAML),
		nil,
		nil)
	if err != nil {
		return nil, err
	}

	// Only process Jobs for now
	if groupVersionKind.Group != "batch" || groupVersionKind.Version != "v1" || groupVersionKind.Kind != "Job" {
		return nil, fmt.Errorf("resource found in %s is not a k8s job, verify the manifest path is for a job resource", path)
	}

View on GitHub (pinned to a1189de023)

Solutions

  1. Check the file: `ls -la <path>` and `cat <path>` — fill it with a valid Job manifest
  2. Fix the manifest path in your config to point at the real, non-empty file
  3. If the manifest is generated, fix the generator (Helm/Kustomize) so it emits content and verify output before deploy
  4. Delete stray empty files that shadow the real manifest

Example fix

// before
kubectl apply -f job.yaml        # job.yaml is 0 bytes
// after
printf 'apiVersion: batch/v1\nkind: Job\n...' > job.yaml
# or correct the path in config:
# manifests: ["k8s/job.yaml"]  (was: ["k8s/empty.yaml"])
Defensive patterns

Strategy: validation

Validate before calling

info, err := os.Stat(path)
if err != nil {
    return fmt.Errorf("manifest missing: %w", err)
}
b, _ := os.ReadFile(path)
if len(bytes.TrimSpace(b)) == 0 {
    return fmt.Errorf("manifest %s is empty", path)
}

Try / catch

obj, err := k8sjob.LoadFromPath(path)
if err != nil {
    if strings.Contains(err.Error(), "empty file found") {
        return fmt.Errorf("check manifest path %q: file is empty", path)
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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