{"record":{"id":"69693614cca7e6a9","repo":"GoogleContainerTools/skaffold","slug":"cannot-locate-this-skaffold-binary-w","errorCode":null,"errorMessage":"cannot locate this Skaffold binary: %w","messagePattern":"cannot locate this Skaffold binary: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/helm/bin.go","lineNumber":150,"sourceCode":"\n\tout := new(bytes.Buffer)\n\terr = Exec(ctx, h, out, false, nil, \"plugin\", \"install\", helmPluginDir)\n\tif err != nil {\n\t\tos.RemoveAll(helmPluginDir)\n\t\treturn nil, nil, PluginErr(\"Failed to install Helm plugin\", errors.New(strings.TrimSpace(out.String())))\n\t}\n\n\tcleanUp := func() {\n\t\tExec(ctx, h, out, false, nil, \"plugin\", \"uninstall\", helmPluginName)\n\t\tos.RemoveAll(helmPluginDir)\n\t}\n\treturn cleanUp, []string{\"--post-renderer\", helmPluginName}, nil\n}\n\nfunc PrepareSkaffoldFilter(h Client, builds []graph.Artifact, flags []string) (skaffoldBinary string, env []string, cleanup func(), err error) {\n\tskaffoldBinary, err = OSExecutable()\n\tif err != nil {\n\t\treturn \"\", nil, nil, fmt.Errorf(\"cannot locate this Skaffold binary: %w\", err)\n\t}\n\n\tvar buildsFile string\n\tif len(builds) > 0 {\n\t\tbuildsFile, cleanup, err = WriteBuildArtifacts(builds)\n\t\tif err != nil {\n\t\t\treturn \"\", nil, nil, fmt.Errorf(\"could not write build-artifacts: %w\", err)\n\t\t}\n\t}\n\tcmdLine := generateSkaffoldFilter(h, buildsFile, flags)\n\tenv = append(env, fmt.Sprintf(\"SKAFFOLD_CMDLINE=%s\", shell.Join(cmdLine...)))\n\tenv = append(env, fmt.Sprintf(\"SKAFFOLD_FILENAME=%s\", h.ConfigFile()))\n\treturn\n}\n\n// generateSkaffoldFilter creates a \"skaffold filter\" command-line for applying the various\n// Skaffold manifest filters, such a debugging, image replacement, and applying labels.\nfunc generateSkaffoldFilter(h Client, buildsFile string, flags []string) []string {","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/helm/bin.go#L132-L168","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-download/reinstall the Skaffold binary (binary may have been replaced or deleted while running)","Ensure /proc is mounted in the container (`/proc/self/exe` resolvable)","Avoid deleting/overwriting the skaffold executable while it is running; install the new version at a new path then swap","Run skaffold directly rather than through exotic exec wrappers"],"exampleFix":"// before\nrm skaffold && curl -o skaffold ...  # while skaffold deploy is running\n// after\ncurl -o skaffold.new ... && mv skaffold skaffold.bak && mv skaffold.new skaffold  # atomic swap after run","handlingStrategy":"validation","validationCode":"ls -l /proc/self/exe && which skaffold  # ensure executable resolves; run skaffold directly","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never delete/overwrite the skaffold binary while it is running","Ensure /proc is mounted in containers","Upgrade skaffold via atomic replace (write new file, then rename)","Avoid exotic exec wrappers when invoking skaffold"],"tags":["helm","post-renderer","executable","environment"],"backgroundTag":"executable-path-resolution-failed","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"}