nektos/act · warning

this step has been cancelled: %w

Error message

this step has been cancelled: %w

What it means

Returned by HostEnvironment.ExecWithCmdLine when the underlying process failed AND the context was already done. It distinguishes a genuine command failure from a command that was killed because the step was cancelled (timeout, job cancellation, interrupt). The %w wraps the real exec error so the cause is preserved.

Source

Thrown at pkg/container/host_environment.go:365

	<-logctx.Done()

	if ppty != nil {
		ppty.Close()
		ppty = nil
	}
	return err
}

func (e *HostEnvironment) Exec(command []string /*cmdline string, */, env map[string]string, user, workdir string) common.Executor {
	return e.ExecWithCmdLine(command, "", env, user, workdir)
}

func (e *HostEnvironment) ExecWithCmdLine(command []string, cmdline string, env map[string]string, user, workdir string) common.Executor {
	return func(ctx context.Context) error {
		if err := e.exec(ctx, command, cmdline, env, user, workdir); err != nil {
			select {
			case <-ctx.Done():
				return fmt.Errorf("this step has been cancelled: %w", err)
			default:
				return err
			}
		}
		return nil
	}
}

func (e *HostEnvironment) UpdateFromEnv(srcPath string, env *map[string]string) common.Executor {
	return parseEnvFile(e, srcPath, env)
}

func (e *HostEnvironment) Remove() common.Executor {
	return func(_ context.Context) error {
		if e.CleanUp != nil {
			e.CleanUp()
		}
		return os.RemoveAll(e.Path)

View on GitHub (pinned to 4f41128141)

Solutions

  1. Treat as cancellation, not a bug: raise timeout-minutes or make the command faster/idempotent.
  2. Inspect the wrapped error (the %w part) to confirm the process was killed (e.g. signal: killed) rather than exiting non-zero on its own.
  3. If cancellation is unexpected, check whether another job in the run failed and act's cancel-on-failure behavior cancelled this step.
  4. Re-run once the environment that caused the cancellation is fixed.

Example fix

# before
- name: build
  run: ./slow-build.sh
  timeout-minutes: 5
# after
- name: build
  run: ./slow-build.sh
  timeout-minutes: 30
Defensive patterns

Strategy: try-catch

Try / catch

err := execStep(ctx)
if err != nil {
  if errors.Is(ctx.Err(), context.Canceled) || errors.Is(ctx.Err(), context.DeadlineExceeded) {
    // step was cancelled: treat as abort, mark job cancelled not failed
    return nil
  }
  return err
}

Prevention

When it happens

Trigger: A step's command exceeds its timeout-minutes and act kills it; the user cancels the run; a job-level deadline cancels the context while a host-executed process is running. exec returns a signal-kill error, ctx.Done() is closed, so this wrapper fires.

Common situations: Long builds/tests hitting timeout-minutes; Ctrl-C during a host (non-Docker) step; matrices where one failing job cancels siblings mid-step.

Related errors


AI-assisted analysis of nektos/act@4f41128141 (2026-08-15). Data as JSON: /api/errors/35ca5cd7903e7bda. Report an issue: GitHub.