{"record":{"id":"a8a390933fd10225","repo":"docker/compose","slug":"wait-cannot-be-combined-with-abort-on-containe","errorCode":null,"errorMessage":"--wait cannot be combined with --abort-on-container-exit, --attach or --attach-dependencies","messagePattern":"--wait cannot be combined with --abort-on-container-exit, --attach or --attach-dependencies","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/compose/up.go","lineNumber":202,"sourceCode":"\t\treturn pflag.NormalizedName(name)\n\t})\n\treturn upCmd\n}\n\n//nolint:gocyclo\nfunc validateFlags(up *upOptions, create *createOptions) error {\n\tif up.waitTimeout < 0 {\n\t\treturn fmt.Errorf(\"--wait-timeout must be a non-negative integer\")\n\t}\n\tif up.exitCodeFrom != \"\" && !up.cascadeFail {\n\t\tup.cascadeStop = true\n\t}\n\tif up.cascadeStop && up.cascadeFail {\n\t\treturn fmt.Errorf(\"--abort-on-container-failure cannot be combined with --abort-on-container-exit\")\n\t}\n\tif up.wait {\n\t\tif up.attachDependencies || up.cascadeStop || len(up.attach) > 0 {\n\t\t\treturn fmt.Errorf(\"--wait cannot be combined with --abort-on-container-exit, --attach or --attach-dependencies\")\n\t\t}\n\t\tup.Detach = true\n\t}\n\tif create.Build && create.noBuild {\n\t\treturn fmt.Errorf(\"--build and --no-build are incompatible\")\n\t}\n\tif up.Detach && (up.attachDependencies || up.cascadeStop || up.cascadeFail || len(up.attach) > 0 || up.watch) {\n\t\tif up.wait {\n\t\t\treturn fmt.Errorf(\"--wait cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach, --attach-dependencies or --watch\")\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"--detach cannot be combined with --abort-on-container-exit, --abort-on-container-failure, --attach, --attach-dependencies or --watch\")\n\t\t}\n\t}\n\tif create.noInherit && create.noRecreate {\n\t\treturn fmt.Errorf(\"--no-recreate and --renew-anon-volumes are incompatible\")\n\t}\n\tif create.forceRecreate && create.noRecreate {\n\t\treturn fmt.Errorf(\"--force-recreate and --no-recreate are incompatible\")","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/compose/up.go#L184-L220","documentation":"Returned by validateFlags when --wait is combined with any attach-mode flag: --attach-dependencies, --abort-on-container-exit (cascadeStop, including the implicit set from --exit-code-from), or explicit --attach SERVICE. --wait implies detached mode plus its own health-based readiness monitoring, which conflicts with streaming logs / aborting on container exit.","triggerScenarios":"`docker compose up --wait --attach web`; `up --wait --attach-dependencies`; `up --wait --abort-on-container-exit`; `up --wait --exit-code-from web` (exit-code-from sets cascadeStop). The check fires only when cascadeStop came from the explicit flag path, not when --wait itself enabled it.","commonSituations":"CI wanting both 'wait until healthy' and 'stream this one service's logs'; teams copying a long flag line and appending --wait; confusion between --wait (healthcheck-based) and attach-based readiness.","solutions":["Pick one model: for health-based readiness use `up --wait --wait-timeout N` and drop attach/abort flags.","To follow logs instead, drop --wait and use `up -d && docker compose logs -f web`.","Replace `--wait --exit-code-from web` with `--wait && docker compose exit-code` style flows or --abort-on-container-failure alone."],"exampleFix":"# before\ndocker compose up --wait --attach web\n\n# after\ndocker compose up --wait\ndocker compose logs -f web &","handlingStrategy":"validation","validationCode":"case \" $* \" in\n  *' --wait '*)\n    for f in --attach-dependencies --abort-on-container-exit --exit-code-from; do\n      [[ \" $* \" == *\" $f\"* ]] && { echo \"--wait cannot combine with $f\" >&2; exit 2; }\n    done;;\nesac\ndocker compose up \"$@\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat --wait as a complete readiness strategy; don't mix with log streaming flags.","Use `up -d && logs -f` when you need detached + logs.","Keep CI up commands short and purpose-built."],"tags":["cli","up","flags","validation","wait","attach","compose"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}