nektos/act · error
--health-interval cannot be negative
Error message
--health-interval cannot be negative
What it means
Error [86]: After a successful ExecCreate, the ExecAttach API call (opening the hijacked stream to the exec) failed. The exec instance exists but act could not attach its stdin/stdout/stdout pipes. Usually a connection-level failure to the daemon or the exec expired/was cleaned up between create and attach.
Source
Thrown at pkg/container/docker_cli.go:586
var healthConfig *container.HealthConfig
haveHealthSettings := copts.healthCmd != "" ||
copts.healthInterval != 0 ||
copts.healthTimeout != 0 ||
copts.healthStartPeriod != 0 ||
copts.healthRetries != 0 ||
copts.healthStartInterval != 0
if copts.noHealthcheck {
if haveHealthSettings {
return nil, errors.New("--no-healthcheck conflicts with --health-* options")
}
healthConfig = &container.HealthConfig{Test: []string{"NONE"}}
} else if haveHealthSettings {
var probe []string
if copts.healthCmd != "" {
probe = []string{"CMD-SHELL", copts.healthCmd}
}
if copts.healthInterval < 0 {
return nil, errors.New("--health-interval cannot be negative")
}
if copts.healthTimeout < 0 {
return nil, errors.New("--health-timeout cannot be negative")
}
if copts.healthRetries < 0 {
return nil, errors.New("--health-retries cannot be negative")
}
if copts.healthStartPeriod < 0 {
return nil, errors.New("--health-start-period cannot be negative")
}
if copts.healthStartInterval < 0 {
return nil, errors.New("--health-start-interval cannot be negative")
}
healthConfig = &container.HealthConfig{
Test: probe,
Interval: copts.healthInterval,
Timeout: copts.healthTimeout,View on GitHub (pinned to 4f41128141)
Solutions
- If DOCKER_HOST is remote, test stability: docker info repeatedly / switch to local socket
- Reduce parallelism (act -j sequential) to lower daemon pressure
- Restart Docker Desktop / dockerd if the socket is in a bad state, then re-run
- Update Docker Engine; older daemons had attach race bugs
Example fix
# before: remote flaky socket export DOCKER_HOST=tcp://flaky-host:2375 # after: local or reliable socket unset DOCKER_HOST # use /var/run/docker.sock
Defensive patterns
Strategy: retry
Try / catch
var lastErr error
for i := 0; i < 3; i++ {
lastErr = run(ctx)
if lastErr == nil || !strings.Contains(lastErr.Error(), "failed to attach to exec") {
break
}
time.Sleep(time.Duration(i+1) * time.Second) // backoff, daemon may recover
} Prevention
- Prefer unix socket DOCKER_HOST over tcp for local runs
- Keepalives on ssh-tunneled docker sockets
- Avoid daemon overload: cap parallel jobs
When it happens
Trigger: cr.cli.ExecAttach erroring: daemon connection dropped (socket closed/TCP reset), exec instance removed before attach, or TTY mismatch with the daemon's expectations.
Common situations: DOCKER_HOST over tcp/ssh with flaky networking; Docker Desktop memory pressure restarting the daemon; heavy parallel execs timing out the attach window; VPN interfering with remote docker sockets.
Related errors
- --uts: invalid UTS mode
- --userns: invalid USER mode
- --health-timeout cannot be negative
- conflicting options: cannot specify both --ip6 and per-netwo
- conflicting options: cannot specify both --mac-address and p
AI-assisted analysis of nektos/act@4f41128141 (2026-08-15).
Data as JSON: /api/errors/31060f84c3e75df4.
Report an issue: GitHub.