docker/cli · error · invalidParamErr

conflicting options: cannot specify both --all and --filter…

Error message

conflicting options: cannot specify both --all and --filter all=1

What it means

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()).

Solutions

  1. Use only --all (or -a) and remove the '--filter all=...' argument.
  2. If all=1 comes from config.json, remove it from the 'pruneFilters' key there before using --all.
  3. To express 'all volumes' via filter only, drop --all and keep '--filter all=1'.

Example fix

# before
docker volume prune --all --filter all=1

# after
docker volume prune --all
Defensive patterns

Strategy: validation

Validate before calling

// Resolve prune filters for 'docker volume prune', forbidding the all= filter when --all is set.
func resolveVolumePruneFilters(allFlag bool, rawFilters []string) ([]string, error) {
    hasAllFilter := false
    for _, f := range rawFilters {
        if strings.HasPrefix(f, "all=") {
            hasAllFilter = true
        }
    }
    if allFlag && hasAllFilter {
        return nil, errors.New("cannot specify both --all and --filter all=...")
    }
    return rawFilters, nil
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of docker/cli@4f84911bfe (2026-08-07). Data as JSON: /api/errors/7f9fa14acb5037b4. Report an issue: GitHub.

Appendix: source

Thrown at cli/command/volume/prune.go:78

	flags.Var(&options.filter, "filter", `Provide filter values (e.g. "label=<label>")`)

	return cmd
}

const (
	unusedVolumesWarning = `WARNING! This will remove anonymous local volumes not used by at least one container.
Are you sure you want to continue?`
	allVolumesWarning = `WARNING! This will remove all local volumes not used by at least one container.
Are you sure you want to continue?`
)

func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) (spaceReclaimed uint64, output string, _ error) {
	pruneFilters := command.PruneFilters(dockerCli, options.filter.Value())

	warning := unusedVolumesWarning
	if options.all {
		if _, ok := pruneFilters["all"]; ok {
			return 0, "", invalidParamErr{errors.New("conflicting options: cannot specify both --all and --filter all=1")}
		}
		pruneFilters.Add("all", "true")
		warning = allVolumesWarning
	}
	if !options.force {
		r, err := prompt.Confirm(ctx, dockerCli.In(), dockerCli.Out(), warning)
		if err != nil {
			return 0, "", err
		}
		if !r {
			return 0, "", cancelledErr{errors.New("volume prune has been cancelled")}
		}
	}

	res, err := dockerCli.Client().VolumePrune(ctx, client.VolumePruneOptions{
		Filters: pruneFilters,
	})
	if err != nil {

View on GitHub (pinned to 4f84911bfe)