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 stringView on GitHub (pinned to 793f7b2e16)
Solutions
- Drop --count when you want everything, or drop --all when you want a bounded result.
- If a wrapper script sets both, make them mutually exclusive in the script (emit --all only when count is empty).
- 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
- In wrappers, build flags conditionally: use --count if COUNT set, else --all if ALL set, else neither
- Shellcheck scripts that compose CLI flags from variables
- Remember default (no --all/--count) returns the first page only
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
- unknown output format %q
- unknown output format %q
- --count must be in the range [1, 500]
- invalid --output %q: must be "text" or "json"
- invalid --override-env value %q: expected format <env>=<repl
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/ee3dc4ef4281a458.
Report an issue: GitHub.