{"record":{"id":"35ca5cd7903e7bda","repo":"nektos/act","slug":"this-step-has-been-cancelled-w","errorCode":null,"errorMessage":"this step has been cancelled: %w","messagePattern":"this step has been cancelled: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/container/host_environment.go","lineNumber":365,"sourceCode":"\t<-logctx.Done()\n\n\tif ppty != nil {\n\t\tppty.Close()\n\t\tppty = nil\n\t}\n\treturn err\n}\n\nfunc (e *HostEnvironment) Exec(command []string /*cmdline string, */, env map[string]string, user, workdir string) common.Executor {\n\treturn e.ExecWithCmdLine(command, \"\", env, user, workdir)\n}\n\nfunc (e *HostEnvironment) ExecWithCmdLine(command []string, cmdline string, env map[string]string, user, workdir string) common.Executor {\n\treturn func(ctx context.Context) error {\n\t\tif err := e.exec(ctx, command, cmdline, env, user, workdir); err != nil {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn fmt.Errorf(\"this step has been cancelled: %w\", err)\n\t\t\tdefault:\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n}\n\nfunc (e *HostEnvironment) UpdateFromEnv(srcPath string, env *map[string]string) common.Executor {\n\treturn parseEnvFile(e, srcPath, env)\n}\n\nfunc (e *HostEnvironment) Remove() common.Executor {\n\treturn func(_ context.Context) error {\n\t\tif e.CleanUp != nil {\n\t\t\te.CleanUp()\n\t\t}\n\t\treturn os.RemoveAll(e.Path)","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/container/host_environment.go#L347-L383","documentation":"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.","triggerScenarios":"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.","commonSituations":"Long builds/tests hitting timeout-minutes; Ctrl-C during a host (non-Docker) step; matrices where one failing job cancels siblings mid-step.","solutions":["Treat as cancellation, not a bug: raise timeout-minutes or make the command faster/idempotent.","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.","If cancellation is unexpected, check whether another job in the run failed and act's cancel-on-failure behavior cancelled this step.","Re-run once the environment that caused the cancellation is fixed."],"exampleFix":"# before\n- name: build\n  run: ./slow-build.sh\n  timeout-minutes: 5\n# after\n- name: build\n  run: ./slow-build.sh\n  timeout-minutes: 30","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := execStep(ctx)\nif err != nil {\n  if errors.Is(ctx.Err(), context.Canceled) || errors.Is(ctx.Err(), context.DeadlineExceeded) {\n    // step was cancelled: treat as abort, mark job cancelled not failed\n    return nil\n  }\n  return err\n}","preventionTips":["Set realistic timeout-minutes on steps that run long commands","Distinguish cancellation from failure in CI summaries","Make commands idempotent so a cancelled-then-rerun step is safe"],"tags":["cancellation","context","exec","timeout","host-runner"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}