{"record":{"id":"e47775fe323a098c","repo":"docker/compose","slug":"s-is-missing-dependency-s","errorCode":null,"errorMessage":"%s is missing dependency %s","messagePattern":"(.+?) is missing dependency (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/compose/convergence.go","lineNumber":175,"sourceCode":"func (s *composeService) waitDependencies(ctx context.Context, project *types.Project, dependant string, dependencies types.DependsOnConfig, containers Containers, timeout time.Duration) error {\n\tif timeout > 0 {\n\t\twithTimeout, cancelFunc := context.WithTimeout(ctx, timeout)\n\t\tdefer cancelFunc()\n\t\tctx = withTimeout\n\t}\n\teg, ctx := errgroup.WithContext(ctx)\n\tfor dep, config := range dependencies {\n\t\tif shouldWait, err := shouldWaitForDependency(dep, config, project); err != nil {\n\t\t\treturn err\n\t\t} else if !shouldWait {\n\t\t\tcontinue\n\t\t}\n\n\t\twaitingFor := containers.filter(isService(dep), isNotOneOff)\n\t\ts.events.On(containerEvents(waitingFor, waiting)...)\n\t\tif len(waitingFor) == 0 {\n\t\t\tif config.Required {\n\t\t\t\treturn fmt.Errorf(\"%s is missing dependency %s\", dependant, dep)\n\t\t\t}\n\t\t\tlogrus.Warnf(\"%s is missing dependency %s\", dependant, dep)\n\t\t\tcontinue\n\t\t}\n\n\t\teg.Go(func() error {\n\t\t\tticker := time.NewTicker(500 * time.Millisecond)\n\t\t\tdefer ticker.Stop()\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase <-ticker.C:\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tswitch config.Condition {\n\t\t\t\tcase ServiceConditionRunningOrHealthy:\n\t\t\t\t\tisHealthy, err := s.isServiceHealthy(ctx, waitingFor, true)\n\t\t\t\t\tif err != nil {","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/pkg/compose/convergence.go#L157-L193","documentation":"waitDependencies waits (500ms tick loop) for each dependency configured in depends_on until its containers are healthy/running. If the dependency service has zero non-one-off containers at wait time and the dependency is required (default, or `required: true`), waiting is pointless and this error is returned immediately; optional dependencies only log a warning instead.","triggerScenarios":"`docker compose up` where service A declares `depends_on: {B: {condition: service_healthy, required: true}}` but B has no containers — B failed to create (bad image, failed build), or a prior error removed it before A's wait phase started.","commonSituations":"Dependency image pull/build failure whose error surfaced after dependent scheduling; depends_on referencing a service name behind a profile that wasn't activated; typos in the dependency key so it never maps to a real service; crash-looping dependencies recreated by `--force-recreate` races.","solutions":["Check why the dependency has no container: `docker compose ps -a`, `docker compose logs <dependency>` — usually the root cause is its own failed start","Fix the dependency name/typo or activate its profile (`--profile x`) so it is part of the project","If the dependency is genuinely optional, mark it `required: false` in depends_on to downgrade the failure to a warning"],"exampleFix":"# before\nservices:\n  app:\n    depends_on:\n      db:\n        condition: service_healthy  # db never created\n\n# after (optional dependency)\nservices:\n  app:\n    depends_on:\n      db:\n        condition: service_healthy\n        required: false","handlingStrategy":"validation","validationCode":"for dep, cfg := range svc.DependsOn {\n    if !cfg.Required { continue }\n    if len(containers.filter(isService(dep), isNotOneOff)) == 0 {\n        return fmt.Errorf(\"required dependency %s of %s has no containers\", dep, svc.Name)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"is missing dependency\") {\n    // inspect `docker compose ps -a <dep>`; fix provider startup or mark required:false, then re-up\n}","preventionTips":["Mark dependencies required:false only when truly optional; keep required ones healthy-tested","Validate depends_on keys against actual service names (and active profiles) before deploying"],"tags":["depends-on","dependencies","startup-order","convergence"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}