{"record":{"id":"511e160a340bdd60","repo":"docker/compose","slug":"container-s-had-unexpected-health-status-q","errorCode":null,"errorMessage":"container %s had unexpected health status %q","messagePattern":"container (.+?) had unexpected health status %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/convergence.go","lineNumber":500,"sourceCode":"\n\t\tnoHealthcheck := ctr.Config.Healthcheck == nil || (len(ctr.Config.Healthcheck.Test) > 0 && ctr.Config.Healthcheck.Test[0] == \"NONE\")\n\t\tif noHealthcheck && fallbackRunning {\n\t\t\t// Container does not define a health check, but we can fall back to \"running\" state\n\t\t\treturn ctr.State != nil && ctr.State.Status == container.StateRunning, nil\n\t\t}\n\n\t\tif ctr.State == nil || ctr.State.Health == nil {\n\t\t\treturn false, fmt.Errorf(\"container %s has no healthcheck configured\", name)\n\t\t}\n\t\tswitch ctr.State.Health.Status {\n\t\tcase container.Healthy:\n\t\t\t// Continue by checking the next container.\n\t\tcase container.Unhealthy:\n\t\t\treturn false, fmt.Errorf(\"container %s is unhealthy\", name)\n\t\tcase container.Starting:\n\t\t\treturn false, nil\n\t\tdefault:\n\t\t\treturn false, fmt.Errorf(\"container %s had unexpected health status %q\", name, ctr.State.Health.Status)\n\t\t}\n\t}\n\treturn true, nil\n}\n\nfunc (s *composeService) isServiceCompleted(ctx context.Context, containers Containers) (bool, int, error) {\n\tfor _, c := range containers {\n\t\tres, err := s.apiClient().ContainerInspect(ctx, c.ID, client.ContainerInspectOptions{})\n\t\tif err != nil {\n\t\t\treturn false, 0, err\n\t\t}\n\t\tif res.Container.State != nil && res.Container.State.Status == container.StateExited {\n\t\t\treturn true, res.Container.State.ExitCode, nil\n\t\t}\n\t}\n\treturn false, 0, nil\n}\n","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/convergence.go#L482-L518","documentation":"Error \"container %s had unexpected health status %q\" thrown in docker/compose.","triggerScenarios":"Docker reported a container health status other than healthy/unhealthy/starting while compose waited on it, which compose does not know how to handle.","commonSituations":"Rare engine or API inconsistency, or a container whose state was altered externally while compose monitored it.","solutions":["Inspect the container with docker inspect to see the reported health status and healthcheck logs.","Ensure the image and Docker engine produce a recognized health status (healthy/unhealthy/starting); upgrade Docker if the status is unknown."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}