pulumi/pulumi · error

--all and --count are mutually exclusive

Error message

--all and --count are mutually exclusive

What it means

The `list` command rejects combining `--all` (enumerate every matching resource) with `--count N` (enumerate up to N), since they specify contradictory pagination limits. It's a plain argument-validation error raised before any provider call.

Source

Thrown at pkg/cmd/pulumi/do/do_resource.go:513

		},
	}
	cmd.Flags().BoolVar(&yes, "yes", false,
		"Automatically approve and perform the operation without a confirmation prompt")
	return cmd
}

func (pc *packageCommand) newResourceListCommand(res *schema.Resource) *cobra.Command {
	var inputFile string
	var inputFormat string
	var all bool
	var count int64
	cmd := &cobra.Command{
		Use:   "list",
		Short: "List resources",
		Args:  cobra.NoArgs,
		RunE: func(cmd *cobra.Command, args []string) error {
			if all && count > 0 {
				return errors.New("--all and --count are mutually exclusive")
			}
			ctx := cmd.Context()
			listing := startSpinner(fmt.Sprintf("Listing %s resources", res.Token))
			defer listing()
			if err := pc.configureProvider(cmd, ctx); err != nil {
				return err
			}

			query, err := evaluateResourceListFile(
				ctx, inputFile, "input", inputFormat, res, pc.evalContext(),
				pc.converter, pc.loaderTarget, pc.packageDescriptor,
				collectInputFlags(cmd, "input", res.ListInputs.Properties))
			if err != nil {
				return fmt.Errorf("parse input file: %w", err)
			}

			var results []plugin.ListResult
			var continuation string

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Drop --count when you want everything, or drop --all when you want a bounded result.
  2. If a wrapper script sets both, make them mutually exclusive in the script (emit --all only when count is empty).
  3. Use just --count N to cap results, or --all alone to page through everything.

Example fix

// before
pulumi package do provider bucket list --all --count 10
// after
pulumi package do provider bucket list --count 10
Defensive patterns

Strategy: validation

Validate before calling

# shell
if [ -n "$ALL" ] && [ -n "$COUNT" ]; then echo "--all and --count are mutually exclusive"; exit 2; fi

Prevention

When it happens

Trigger: Invoking `pulumi package <provider> <type> list --all --count 10` (or --count > 0 together with --all) in a script or alias.

Common situations: Script variables defaulting --all to true while also passing --count; copying an example and appending an extra flag; wrapper scripts that merge both options.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/ee3dc4ef4281a458. Report an issue: GitHub.