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 nil

View on GitHub (pinned to a1189de023)

Solutions

  1. Verify the command exists: run it manually in the same shell; fix PATH or install the binary (e.g. kubectl)
  2. Check the command string and arguments passed to the Cmd for typos
  3. Confirm the working directory configured on the Cmd exists and is accessible
  4. 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

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


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