nektos/act · error

--health-start-period cannot be negative

Error message

--health-start-period cannot be negative

What it means

Error [89]: The step's command inside the container exited with a non-zero code that is not 127. The wrapped number is the command's actual exit status. Act surfaces it as the step failure — this is the normal mechanism by which a failing run: step (or exec) fails the job. Fix the command/script, not act.

Source

Thrown at pkg/container/docker_cli.go:595

			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,
			StartPeriod:   copts.healthStartPeriod,
			StartInterval: copts.healthStartInterval,
			Retries:       copts.healthRetries,
		}
	}

	deviceRequests := copts.gpus.Value()
	if len(cdiDeviceNames) > 0 {
		cdiDeviceRequest := container.DeviceRequest{

View on GitHub (pinned to 4f41128141)

Solutions

  1. Read the step's stdout/stderr just above the error — the real failure is printed there
  2. Reproduce locally: docker run --rm -it <image> <command> and iterate
  3. For git 'dubious ownership': git config --global --add safe.directory '*' inside the container
  4. Compare env/context: use act -v or add env dumps to see missing variables vs real CI

Example fix

# before
- run: npm test   # exits 1
# after (make failure diagnosable / fix the cause)
- run: npm test || (cat /path/log; exit 1)
Defensive patterns

Strategy: try-catch

Validate before calling

null // exit codes are the app under test; validate the command/toolchain exists instead
if _, err := exec.LookPath("docker"); err != nil { log.Fatal(err) }

Try / catch

if err := job(ctx); err != nil {
	if m := regexp.MustCompile(`exitcode '(\d+)': failure`).FindStringSubmatch(err.Error()); m != nil {
		log.Printf("step failed with exit %s — see output above", m[1])
	}
}

Prevention

When it happens

Trigger: Any Exec in the container (run step, git clone, chown, action entrypoint) whose process exits non-zero: failing tests, missing files, permission denied, failed tool invocations.

Common situations: A test suite failing inside act like it would on GitHub Actions; git safe.directory errors when act runs as a different UID inside the container; permission errors from bind mounts; environment differences (env vars set on GH but not locally).

Related errors


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