GoogleContainerTools/skaffold · error

could not read the hydrated manifest from %v: %w

Error message

could not read the hydrated manifest from %v: %w

What it means

The kpt deployer reads hydrated manifests from k.applyDir before deploying. If reading that directory fails (getManifests error), the deployer reports this DeployInfoEvent describing the unreadable hydrated manifest path. It is logged as an event rather than aborting immediately, but downstream deploy steps will lack manifests.

Source

Thrown at pkg/skaffold/deploy/kpt/kpt.go:321

		if err = os.WriteFile(kptFilePath, configByte, 0644); err != nil {
			return err
		}
	}
	return nil
}

func (k *Deployer) Deploy(ctx context.Context, out io.Writer, builds []graph.Artifact, _ manifest.ManifestListByConfig) error {
	if err := kptInitFunc(ctx, out, k); err != nil {
		return err
	}

	instrumentation.AddAttributesToCurrentSpanFromContext(ctx, map[string]string{
		"DeployerType": deployerName,
	})
	_, endTrace := instrumentation.StartTrace(ctx, "Deploy_ReadHydratedManifests")
	manifests, err := k.getManifests(ctx)
	if err != nil {
		event.DeployInfoEvent(fmt.Errorf("could not read the hydrated manifest from %v: %w", k.applyDir, err))
	}
	endTrace()

	// Add debug transformations
	debugHelpersRegistry, err := config.GetDebugHelpersRegistry(k.globalConfig)
	if err != nil {
		return err
	}
	if manifests, err = manifest.ApplyTransforms(manifests, builds, k.insecureRegistries, debugHelpersRegistry); err != nil {
		return err
	}

	_, endTrace = instrumentation.StartTrace(ctx, "Deploy_CollectNamespaces")
	namespaces, err := manifests.CollectNamespaces()
	if err != nil {
		event.DeployInfoEvent(fmt.Errorf("could not fetch deployed resource namespace. "+
			"This might cause port-forward and deploy health-check to fail: %w", err))
	}

View on GitHub (pinned to a1189de023)

Solutions

  1. Check the log for the wrapped root cause (%w) and fix the underlying read error (missing/renamed applyDir, permissions).
  2. Run the kpt hydration step (`kpt fn render`) and verify manifests exist in the applyDir before deploying.
  3. Correct the skaffold kpt deployer's applyDir/hydratedManifests configuration paths.
  4. Re-run `skaffold dev/deploy` after cleaning the hydration output directory.

Example fix

// before: deploying without hydrating
skaffold apply --kpt-hydrated-manifests=out/hydrated
// after: hydrate first
kpt fn render -i base -o out/hydrated
skaffold apply --kpt-hydrated-manifests=out/hydrated
Defensive patterns

Strategy: validation

Validate before calling

// Check hydrated manifests exist before applying
if _, err := os.Stat(k.applyDir); err != nil {
    return fmt.Errorf("applyDir %s missing; run kpt fn render first: %w", k.applyDir, err)
}

Try / catch

// Wrap and surface the DeployInfoEvent root cause
cmd, err := run()
if errors.As(err, &fsErr) {
    log.Fatalf("hydrated manifest unreadable at %s: %v", applyDir, fsErr)
}

Prevention

When it happens

Trigger: k.getManifests(ctx) fails during Deploy — e.g. applyDir does not exist, is not readable, or hydration (kpt fn render) never produced output files at k.applyDir.

Common situations: kpt pipeline hydration failed silently in a prior step; wrong `--kpt-hydrated-manifests` / applyDir path; running apply on a fresh checkout without hydrating first; filesystem permissions on the output directory.

Related errors


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