{"record":{"id":"ac2ebb51c0ef8143","repo":"docker/compose","slug":"abort-on-container-failure-cannot-be-combined-wi","errorCode":null,"errorMessage":"--abort-on-container-failure cannot be combined with --abort-on-container-exit","messagePattern":"--abort-on-container-failure cannot be combined with --abort-on-container-exit","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/compose/up.go","lineNumber":198,"sourceCode":"\t\tif name == \"y\" {\n\t\t\tlogrus.Warn(\"--y is deprecated, please use --yes instead\")\n\t\t\tname = \"yes\"\n\t\t}\n\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 {","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/compose/up.go#L180-L216","documentation":"Returned by validateFlags for `docker compose up` when both cascade-stop behaviors are enabled. --abort-on-container-exit sets cascadeStop; --abort-on-container-failure sets cascadeFail. Note the implicit link: passing --exit-code-from without --abort-on-container-failure also sets cascadeStop, so combining `--exit-code-from svc --abort-on-container-failure` triggers this error too. The two abort semantics (stop on ANY exit vs. stop only on failure) are mutually exclusive.","triggerScenarios":"`docker compose up --abort-on-container-exit --abort-on-container-failure`; or `docker compose up --exit-code-from web --abort-on-container-failure` (exit-code-from implies cascadeStop when cascadeFail is not already set, then the explicit flag makes both true).","commonSituations":"CI configs accumulating flags over time until two abort modes coexist; copying flag sets between docs/versions; users assuming --exit-code-from is independent of the abort flags.","solutions":["Keep exactly one abort mode: use `--abort-on-container-failure --exit-code-from web` (recommended for CI, stops only on failure), dropping --abort-on-container-exit.","Or keep `--abort-on-container-exit --exit-code-from web` and drop --abort-on-container-failure.","Audit wrapper scripts/Makefiles that concatenate COMPOSE_UP_FLAGS from multiple variables."],"exampleFix":"# before\ndocker compose up --abort-on-container-exit --abort-on-container-failure --exit-code-from web\n\n# after\ndocker compose up --abort-on-container-failure --exit-code-from web","handlingStrategy":"validation","validationCode":"# allow exactly one abort mode in CI wrappers\nABORT_FLAGS=$(echo \"$UP_FLAGS\" | grep -o -- '--abort-on-container-[a-z]*' | sort -u)\n[ \"$(wc -l <<<\"$ABORT_FLAGS\")\" -gt 1 ] && { echo 'conflicting abort flags' >&2; exit 2; }\ndocker compose up $UP_FLAGS","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize CI on --abort-on-container-failure --exit-code-from X.","Know --exit-code-from implies abort-on-container-exit semantics.","Build flag strings from one mutually exclusive choice, not independent toggles."],"tags":["cli","up","flags","validation","abort","compose"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}