{"id":"79b6e93003e10f63","repo":"docker/cli","slug":"health-start-interval-cannot-be-negative","errorCode":null,"errorMessage":"--health-start-interval cannot be negative","messagePattern":"--health-start-interval cannot be negative","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/command/container/opts.go","lineNumber":591,"sourceCode":"\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\n\tdeviceRequests := copts.gpus.Value()\n\tif len(cdiDeviceNames) > 0 {\n\t\tcdiDeviceRequest := container.DeviceRequest{\n\t\t\tDriver:    \"cdi\",\n\t\t\tDeviceIDs: cdiDeviceNames,\n\t\t}","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/container/opts.go#L573-L609","documentation":"--health-start-interval (added with API 1.44 / Docker 25) sets the probe interval used during the start period; the CLI rejects negative durations before sending the create request (opts.go:590-592). As with the other health durations, 0 means 'default' and negatives are meaningless.","triggerScenarios":"`docker run --health-cmd '...' --health-start-interval=-2s image` on run/create; any negative duration reaching this flag while other health settings are present.","commonSituations":"Negative values from script variables; trying sentinel semantics (-1) to disable the faster start-period probing; also note older daemons (<25.0/API 1.44) reject this flag entirely, a separate but related pitfall.","solutions":["Set a positive duration, e.g. --health-start-interval=2s","Omit the flag or pass 0 to fall back to the default behavior","Ensure the daemon supports API 1.44+ if you rely on this flag at all"],"exampleFix":"# before\ndocker run --health-cmd 'curl -f localhost' --health-start-interval=-2s myimage\n# after\ndocker run --health-cmd 'curl -f localhost' --health-start-interval=2s myimage","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","healthcheck","duration","flag-validation"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}