GoogleContainerTools/skaffold · error
could not start the command: %w
Error message
could not start the command: %w
What it means
Start starts the actual c.Cmd process after configuring the job object; this error wraps os/exec Start failure. The command itself could not be launched — the job-object machinery was fine, but the executable didn't start.
Source
Thrown at pkg/skaffold/kubectl/exec_windows.go:64
return fmt.Errorf("could not create job object: %w", err)
}
// https://gist.github.com/hallazzang/76f3970bfc949831808bbebc8ca15209
info := windows.JOBOBJECT_EXTENDED_LIMIT_INFORMATION{
BasicLimitInformation: windows.JOBOBJECT_BASIC_LIMIT_INFORMATION{
LimitFlags: windows.JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE,
},
}
if _, err := windows.SetInformationJobObject(
handle,
windows.JobObjectExtendedLimitInformation,
uintptr(unsafe.Pointer(&info)),
uint32(unsafe.Sizeof(info))); err != nil {
return fmt.Errorf("could not set information job object: %w", err)
}
if err := c.Cmd.Start(); err != nil {
return fmt.Errorf("could not start the command: %w", err)
}
processHandle, err := getHandleFromProcess(c.Process)
if err != nil {
return fmt.Errorf("could not get handle from process: %w", err)
}
if err := windows.AssignProcessToJobObject(handle, processHandle); err != nil {
return fmt.Errorf("could not assign job object: %w", err)
}
c.handle = handle
go func() {
<-c.ctx.Done()
c.Terminate()
}()
return nilView on GitHub (pinned to a1189de023)
Solutions
- Verify the command exists: run it manually in the same shell; fix PATH or install the binary (e.g. kubectl)
- Check the command string and arguments passed to the Cmd for typos
- Confirm the working directory configured on the Cmd exists and is accessible
- Check antivirus quarantine logs if the binary exists but won't start
Example fix
// before
c := exec.Command("kubctl", "apply", "-f", "job.yaml") // typo
// after
c := exec.Command("kubectl", "apply", "-f", "job.yaml") Defensive patterns
Strategy: validation
Validate before calling
bin := "kubectl"
if _, err := exec.LookPath(bin); err != nil {
return fmt.Errorf("%s not on PATH: %w", bin, err)
} Try / catch
if err := c.Start(); err != nil {
var execErr *exec.Error
if errors.As(err, &execErr) {
return fmt.Errorf("executable %q not found; install it or fix PATH", execErr.Name)
}
return err
} Prevention
- Use exec.LookPath to verify the binary exists before building the Cmd
- Ensure the Cmd's Dir working directory exists and is readable
- Keep target binaries (kubectl) installed and on PATH in CI images
- Check AV quarantine if the binary exists but Start still fails
When it happens
Trigger: c.Cmd.Start() returns an error: executable not found in PATH (exec: "foo": executable file not found), missing execute permission, bad working directory, or the binary was deleted between lookup and spawn.
Common situations: kubectl or the target binary not installed / not on PATH on the Windows machine, PATH differences between shells, antivirus quarantining the binary, running a .bat/.cmd without proper resolution.
Related errors
- starting cmd: %w
- could not create job object: %w
- could not set information job object: %w
- could not get handle from process: %w
- could not assign job object: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/963d63dbb46b69ce.
Report an issue: GitHub.