{"id":"7f9fa14acb5037b4","repo":"docker/cli","slug":"conflicting-options-cannot-specify-both-all-and","errorCode":null,"errorMessage":"conflicting options: cannot specify both --all and --filter all=1","messagePattern":"conflicting options: cannot specify both --all and --filter all=1","errorType":"validation","errorClass":"invalidParamErr","httpStatus":null,"severity":"error","filePath":"cli/command/volume/prune.go","lineNumber":78,"sourceCode":"\tflags.Var(&options.filter, \"filter\", `Provide filter values (e.g. \"label=<label>\")`)\n\n\treturn cmd\n}\n\nconst (\n\tunusedVolumesWarning = `WARNING! This will remove anonymous local volumes not used by at least one container.\nAre you sure you want to continue?`\n\tallVolumesWarning = `WARNING! This will remove all local volumes not used by at least one container.\nAre you sure you want to continue?`\n)\n\nfunc runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) (spaceReclaimed uint64, output string, _ error) {\n\tpruneFilters := command.PruneFilters(dockerCli, options.filter.Value())\n\n\twarning := unusedVolumesWarning\n\tif options.all {\n\t\tif _, ok := pruneFilters[\"all\"]; ok {\n\t\t\treturn 0, \"\", invalidParamErr{errors.New(\"conflicting options: cannot specify both --all and --filter all=1\")}\n\t\t}\n\t\tpruneFilters.Add(\"all\", \"true\")\n\t\twarning = allVolumesWarning\n\t}\n\tif !options.force {\n\t\tr, err := prompt.Confirm(ctx, dockerCli.In(), dockerCli.Out(), warning)\n\t\tif err != nil {\n\t\t\treturn 0, \"\", err\n\t\t}\n\t\tif !r {\n\t\t\treturn 0, \"\", cancelledErr{errors.New(\"volume prune has been cancelled\")}\n\t\t}\n\t}\n\n\tres, err := dockerCli.Client().VolumePrune(ctx, client.VolumePruneOptions{\n\t\tFilters: pruneFilters,\n\t})\n\tif err != nil {","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/docker/cli/blob/e9452d6e785f6e365712b9d71bd7517591773c86/cli/command/volume/prune.go#L60-L96","documentation":"Raised by `docker volume prune` when the --all/-a flag is combined with an explicit `--filter all=1` (or all=true). --all is implemented by adding the `all=true` prune filter internally, so specifying both is redundant and potentially contradictory; the CLI rejects it as an invalid parameter.","triggerScenarios":"`docker volume prune --all --filter all=1` — options.all is true and pruneFilters already contains an \"all\" key at cli/command/volume/prune.go:78.","commonSituations":"Scripts written for older API versions using `--filter all=1` (the pre---all way to include named volumes) later updated to add -a as well; copy-pasted commands mixing both idioms; wrapper tools that inject --all onto user-supplied filter sets.","solutions":["Use just one form: `docker volume prune --all` (preferred on modern CLI/API >= 1.42).","Or keep only the filter form: `docker volume prune --filter all=1` and drop -a/--all.","Audit wrapper scripts so they don't add --all when the user already passed an all filter."],"exampleFix":"# before\ndocker volume prune --all --filter all=1 -f\n# after\ndocker volume prune --all -f","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["docker-cli","volume","prune","flag-conflict"],"analyzedSha":"e9452d6e785f6e365712b9d71bd7517591773c86","analyzedAt":"2026-08-01T07:09:22.474Z","schemaVersion":2}