{"id":"b575762b12225c00","repo":"docker/cli","slug":"test-and-disable-can-t-be-set-at-the-same-time","errorCode":null,"errorMessage":"test and disable can't be set at the same time","messagePattern":"test and disable can't be set at the same time","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/convert/service.go","lineNumber":443,"sourceCode":"\t\tif hostName, ipAddr, ok := strings.Cut(hostIP, \":\"); ok {\n\t\t\t// Convert to SwarmKit notation: IP-address hostname(s)\n\t\t\thosts = append(hosts, ipAddr+\" \"+hostName)\n\t\t}\n\t}\n\treturn hosts\n}\n\nfunc convertHealthcheck(healthcheck *composetypes.HealthCheckConfig) (*container.HealthConfig, error) {\n\tif healthcheck == nil {\n\t\treturn nil, nil\n\t}\n\tvar (\n\t\ttimeout, interval, startPeriod, startInterval time.Duration\n\t\tretries                                       int\n\t)\n\tif healthcheck.Disable {\n\t\tif len(healthcheck.Test) != 0 {\n\t\t\treturn nil, errors.New(\"test and disable can't be set at the same time\")\n\t\t}\n\t\treturn &container.HealthConfig{\n\t\t\tTest: []string{\"NONE\"},\n\t\t}, nil\n\t}\n\tif healthcheck.Timeout != nil {\n\t\ttimeout = time.Duration(*healthcheck.Timeout)\n\t}\n\tif healthcheck.Interval != nil {\n\t\tinterval = time.Duration(*healthcheck.Interval)\n\t}\n\tif healthcheck.StartPeriod != nil {\n\t\tstartPeriod = time.Duration(*healthcheck.StartPeriod)\n\t}\n\tif healthcheck.StartInterval != nil {\n\t\tstartInterval = time.Duration(*healthcheck.StartInterval)\n\t}\n\tif healthcheck.Retries != nil {","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/compose/convert/service.go#L425-L461","documentation":"Raised by convertHealthcheck in the compose-to-swarm converter when a service's healthcheck sets `disable: true` while also providing a `test` command. Disabling means the converter emits Test: [\"NONE\"], which contradicts an explicit test, so the ambiguous config is rejected rather than silently picking one.","triggerScenarios":"Deploying with `docker stack deploy` a compose file where a service has `healthcheck: {disable: true, test: [...]}`. Any non-empty Test list combined with Disable triggers it during conversion, before the service is created.","commonSituations":"Temporarily disabling a healthcheck by adding `disable: true` without removing/commenting the existing `test`; merged/override compose files (docker-compose.yml + override) where one file sets test and another sets disable; copy-paste from examples.","solutions":["Remove the `test:` entry (or the whole healthcheck block except `disable: true`) if you want the check disabled","Remove `disable: true` if you want the healthcheck to run","Check merged config with `docker compose config` to find which override file injects the conflicting key"],"exampleFix":"# before\nhealthcheck:\n  disable: true\n  test: [\"CMD\", \"curl\", \"-f\", \"http://localhost/\"]\n# after\nhealthcheck:\n  disable: true","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","compose","swarm","healthcheck","stack-deploy"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}