{"record":{"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/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/command/volume/prune.go#L60-L96","documentation":"Returned by runPrune (volume/prune.go:77-79) when 'docker volume prune' is invoked with both the --all flag AND the equivalent '--filter all=1'. The --all flag is itself sugar that adds the 'all' filter, so specifying both is redundant and the CLI treats it as a conflicting-options error (wrapped in invalidParamErr which satisfies InvalidParameter()).","triggerScenarios":"Running 'docker volume prune --all --filter all=1', or 'docker volume prune -a --filter all=true'. Also if a config.json prune-filter default adds 'all=1' while the user also passes --all on the CLI.","commonSituations":"Copy-pasting a filter expression from docs/scripts while also passing -a. Having a global prune-filter set in ~/.docker/config.json (utils.go:35 PruneFilters merges them) that injects all=1, then running --all.","solutions":["Use only --all (or -a) and remove the '--filter all=...' argument.","If all=1 comes from config.json, remove it from the 'pruneFilters' key there before using --all.","To express 'all volumes' via filter only, drop --all and keep '--filter all=1'."],"exampleFix":"# before\ndocker volume prune --all --filter all=1\n\n# after\ndocker volume prune --all","handlingStrategy":"validation","validationCode":"// Resolve prune filters for 'docker volume prune', forbidding the all= filter when --all is set.\nfunc resolveVolumePruneFilters(allFlag bool, rawFilters []string) ([]string, error) {\n    hasAllFilter := false\n    for _, f := range rawFilters {\n        if strings.HasPrefix(f, \"all=\") {\n            hasAllFilter = true\n        }\n    }\n    if allFlag && hasAllFilter {\n        return nil, errors.New(\"cannot specify both --all and --filter all=...\")\n    }\n    return rawFilters, nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pick one expression of 'all': either --all or '--filter all=1', never both.","Audit ~/.docker/config.json pruneFilters for a stray 'all=1' before using --all.","Wrap prune invocations in a helper that normalizes filters and rejects the combination up front."],"tags":["docker-volume","prune","filter","argument-conflict","validation"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}