{"record":{"id":"a6a24aa3e6533392","repo":"nektos/act","slug":"health-retries-cannot-be-negative","errorCode":null,"errorMessage":"--health-retries cannot be negative","messagePattern":"--health-retries cannot be negative","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/container/docker_cli.go","lineNumber":592,"sourceCode":"\t\tcopts.healthStartInterval != 0\n\tif copts.noHealthcheck {\n\t\tif haveHealthSettings {\n\t\t\treturn nil, errors.New(\"--no-healthcheck conflicts with --health-* options\")\n\t\t}\n\t\thealthConfig = &container.HealthConfig{Test: []string{\"NONE\"}}\n\t} else if haveHealthSettings {\n\t\tvar probe []string\n\t\tif copts.healthCmd != \"\" {\n\t\t\tprobe = []string{\"CMD-SHELL\", copts.healthCmd}\n\t\t}\n\t\tif copts.healthInterval < 0 {\n\t\t\treturn nil, errors.New(\"--health-interval cannot be negative\")\n\t\t}\n\t\tif copts.healthTimeout < 0 {\n\t\t\treturn nil, errors.New(\"--health-timeout cannot be negative\")\n\t\t}\n\t\tif copts.healthRetries < 0 {\n\t\t\treturn nil, errors.New(\"--health-retries cannot be negative\")\n\t\t}\n\t\tif copts.healthStartPeriod < 0 {\n\t\t\treturn nil, errors.New(\"--health-start-period cannot be negative\")\n\t\t}\n\t\tif copts.healthStartInterval < 0 {\n\t\t\treturn nil, errors.New(\"--health-start-interval cannot be negative\")\n\t\t}\n\n\t\thealthConfig = &container.HealthConfig{\n\t\t\tTest:          probe,\n\t\t\tInterval:      copts.healthInterval,\n\t\t\tTimeout:       copts.healthTimeout,\n\t\t\tStartPeriod:   copts.healthStartPeriod,\n\t\t\tStartInterval: copts.healthStartInterval,\n\t\t\tRetries:       copts.healthRetries,\n\t\t}\n\t}\n","sourceCodeStart":574,"sourceCodeEnd":610,"githubUrl":"https://github.com/nektos/act/blob/4f411281417e88660bea1c1a1749aa71ae0bd60f/pkg/container/docker_cli.go#L574-L610","documentation":"Error [88]: The step's command inside the container exited with code 127 — the shell's 'command not found' code. Act maps it explicitly and links nektos/act#107 because it almost always means the image lacks /bin/bash (or the requested shell) and steps fail on every 'shell: bash' run. This is not a Docker API error; it is the job command failing in-image.","triggerScenarios":"A workflow step uses shell: bash (act's default for run:) in an image without bash (alpine, distroless, scratch); the entrypoint script references a missing binary; a local action's entrypoint uses bash while the job container is alpine.","commonSituations":"Default act images aside, using runs-on container images like alpine where only sh/ash exist; distroless images; images where bash is not on PATH; scripts with a #!/bin/bash shebang run via 'sh -c'.","solutions":["Install bash in the image or switch the image to one with bash (debian/ubuntu based)","Set the step shell explicitly: shell: sh (or ash) for alpine images","Use 'runs-on: ubuntu-latest' (act maps to its default images with bash) for bash-dependent steps","For local actions, make entrypoint scripts POSIX sh compatible"],"exampleFix":"# before\njobs:\n  build:\n    runs-on: ubuntu-latest\n    container: alpine:latest\n    steps:\n      - run: echo hi   # defaults to bash\n# after\n    steps:\n      - run: echo hi\n        shell: sh","handlingStrategy":"validation","validationCode":"// Choose shell per image family before running\nfunc shellFor(image string) string {\n\tif strings.Contains(image, \"alpine\") || strings.Contains(image, \"busybox\") {\n\t\treturn \"sh\"\n\t}\n\treturn \"bash\"\n}","typeGuard":"func imageHasBash(image string) bool {\n\t// check via docker if scripting\n\tout, err := exec.Command(\"docker\", \"run\", \"--rm\", image, \"sh\", \"-c\", \"command -v bash\").Output()\n\treturn err == nil && len(out) > 0\n}","tryCatchPattern":"if err := step(ctx); err != nil && strings.Contains(err.Error(), \"exitcode '127'\") {\n\t// set shell: sh on the step and re-run\n}","preventionTips":["Default to shell: sh in workflows that target alpine","Install bash in custom base images","Test local action entrypoints with sh, not bash"],"tags":["docker","exit-code","shell","alpine","bash"],"backgroundTag":null,"analyzedSha":"4f411281417e88660bea1c1a1749aa71ae0bd60f","analyzedAt":"2026-08-15T09:19:46.307Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}