GoogleContainerTools/skaffold · error

cannot locate this Skaffold binary: %w

Error message

cannot locate this Skaffold binary: %w

What it means

PrepareSkaffoldFilter sets up a Helm post-renderer that re-invokes this very Skaffold binary to inject build artifacts into the rendered manifests. It first resolves the current executable via OSExecutable(); if that fails, the post-renderer cannot be configured and this wrapped error is returned.

Source

Thrown at pkg/skaffold/helm/bin.go:150

	out := new(bytes.Buffer)
	err = Exec(ctx, h, out, false, nil, "plugin", "install", helmPluginDir)
	if err != nil {
		os.RemoveAll(helmPluginDir)
		return nil, nil, PluginErr("Failed to install Helm plugin", errors.New(strings.TrimSpace(out.String())))
	}

	cleanUp := func() {
		Exec(ctx, h, out, false, nil, "plugin", "uninstall", helmPluginName)
		os.RemoveAll(helmPluginDir)
	}
	return cleanUp, []string{"--post-renderer", helmPluginName}, nil
}

func PrepareSkaffoldFilter(h Client, builds []graph.Artifact, flags []string) (skaffoldBinary string, env []string, cleanup func(), err error) {
	skaffoldBinary, err = OSExecutable()
	if err != nil {
		return "", nil, nil, fmt.Errorf("cannot locate this Skaffold binary: %w", err)
	}

	var buildsFile string
	if len(builds) > 0 {
		buildsFile, cleanup, err = WriteBuildArtifacts(builds)
		if err != nil {
			return "", nil, nil, fmt.Errorf("could not write build-artifacts: %w", err)
		}
	}
	cmdLine := generateSkaffoldFilter(h, buildsFile, flags)
	env = append(env, fmt.Sprintf("SKAFFOLD_CMDLINE=%s", shell.Join(cmdLine...)))
	env = append(env, fmt.Sprintf("SKAFFOLD_FILENAME=%s", h.ConfigFile()))
	return
}

// generateSkaffoldFilter creates a "skaffold filter" command-line for applying the various
// Skaffold manifest filters, such a debugging, image replacement, and applying labels.
func generateSkaffoldFilter(h Client, buildsFile string, flags []string) []string {

View on GitHub (pinned to a1189de023)

Solutions

  1. Re-download/reinstall the Skaffold binary (binary may have been replaced or deleted while running)
  2. Ensure /proc is mounted in the container (`/proc/self/exe` resolvable)
  3. Avoid deleting/overwriting the skaffold executable while it is running; install the new version at a new path then swap
  4. Run skaffold directly rather than through exotic exec wrappers

Example fix

// before
rm skaffold && curl -o skaffold ...  # while skaffold deploy is running
// after
curl -o skaffold.new ... && mv skaffold skaffold.bak && mv skaffold.new skaffold  # atomic swap after run
Defensive patterns

Strategy: validation

Validate before calling

ls -l /proc/self/exe && which skaffold  # ensure executable resolves; run skaffold directly

Prevention

When it happens

Trigger: OSExecutable() returns an error, typically when /proc/self/exe or the OS executable path cannot be resolved (deleted binary, exotic sandbox/exec environments), before WriteBuildArtifacts runs.

Common situations: Running a deleted/overwritten skaffold binary (upgraded in place while running); restricted container runtimes where /proc is not mounted; unusual exec wrappers where os.Executable fails.

Related errors


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