{"record":{"id":"858f5b70c4037bdf","repo":"docker/compose","slug":"no-recreate-and-renew-anon-volumes-are-incompa","errorCode":null,"errorMessage":"--no-recreate and --renew-anon-volumes are incompatible","messagePattern":"--no-recreate and --renew-anon-volumes are incompatible","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/compose/up.go","lineNumber":217,"sourceCode":"\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\")\n\t}\n\tif create.recreateDeps && create.noRecreate {\n\t\treturn fmt.Errorf(\"--always-recreate-deps and --no-recreate are incompatible\")\n\t}\n\tif create.noBuild && up.watch {\n\t\treturn fmt.Errorf(\"--no-build and --watch are incompatible\")\n\t}\n\treturn nil\n}\n\n//nolint:gocyclo\nfunc runUp(\n\tctx context.Context,\n\tdockerCli command.Cli,\n\tbackendOptions *BackendOptions,","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/cmd/compose/up.go#L199-L235","documentation":"Returned by validateFlags when create.noInherit and create.noRecreate are both set. The message names --renew-anon-volumes, which is the user-facing flag that historically maps to the noInherit option (recreating anonymous volumes means not inheriting the previous container's volumes). Renewing anonymous volumes requires recreating the container, so combining it with --no-recreate (which forbids recreation) is contradictory and rejected.","triggerScenarios":"`docker compose up --no-recreate --renew-anon-volumes`; the same combination via `docker compose create`/`run` paths that share createOptions and call validateFlags. Scripts that always pass --renew-anon-volumes to avoid stale data colliding with a --no-recreate added to preserve running containers.","commonSituations":"Teams pinning --no-recreate to keep containers alive during config-only changes, then adding --renew-anon-volumes to fix stale database data; long Makefile targets accumulating both flags across refactors.","solutions":["Drop --no-recreate when you need fresh anonymous volumes (renewal requires recreation).","Or drop --renew-anon-volumes and accept inherited anonymous volume data.","Consider named volumes for data you manage explicitly, making this flag pair unnecessary."],"exampleFix":"# before\ndocker compose up --no-recreate --renew-anon-volumes\n\n# after\ndocker compose up --renew-anon-volumes","handlingStrategy":"validation","validationCode":"if [[ \"$UP_FLAGS\" == *--no-recreate* && \"$UP_FLAGS\" == *--renew-anon-volumes* ]]; then\n  echo 'renew-anon-volumes requires recreation; drop --no-recreate' >&2; exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Move stateful data to named volumes so --renew-anon-volumes becomes unnecessary.","Understand --renew-anon-volumes implies container recreation."],"tags":["cli","up","flags","validation","volumes","compose"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}