GoogleContainerTools/skaffold · error

could not create job object: %w

Error message

could not create job object: %w

What it means

On Windows, Cmd.Start creates a Windows Job Object via windows.CreateJobObject so child processes can be killed as a group; this error wraps a failure to create that kernel job object. It means the OS refused the CreateJobObject call before the command was even started.

Source

Thrown at pkg/skaffold/kubectl/exec_windows.go:46

)

// Cmd represents an external command being prepared to run within a job object
type Cmd struct {
	*exec.Cmd
	handle windows.Handle
	ctx    context.Context
}

// CommandContext creates a new Cmd
func CommandContext(ctx context.Context, name string, arg ...string) *Cmd {
	return &Cmd{Cmd: exec.CommandContext(ctx, name, arg...), ctx: ctx}
}

// Start starts the specified command in a job object but does not wait for it to complete
func (c *Cmd) Start() error {
	handle, err := windows.CreateJobObject(nil, nil)
	if err != nil {
		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)

View on GitHub (pinned to a1189de023)

Solutions

  1. Run the command from an elevated or less-restricted shell (normal user terminal rather than a restricted service context)
  2. Check antivirus/EDP software logs and whitelist the executable
  3. Update Windows/golang.org/x/sys/windows package to a current version
  4. As a workaround, disable the process-group kill feature or run on a non-Windows environment
Defensive patterns

Strategy: fallback

Try / catch

if err := c.Start(); err != nil {
    var pe *fs.PathError
    if errors.As(err, &pe) {
        return fmt.Errorf("job object create failed (%v); environment may restrict job objects", err)
    }
    return err
}

Prevention

When it happens

Trigger: windows.CreateJobObject(nil, nil) returns an error — typically due to Win32 API failure such as ERROR_ACCESS_DENIED in restricted environments, corrupted security settings, or resource exhaustion in the calling process.

Common situations: Running skaffold inside a hardened Windows sandbox/service with restricted token privileges, antivirus or endpoint software blocking job-object creation, running under restricted service accounts.

Related errors


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