{"record":{"id":"ee3dc4ef4281a458","repo":"pulumi/pulumi","slug":"all-and-count-are-mutually-exclusive-ee3dc4","errorCode":null,"errorMessage":"--all and --count are mutually exclusive","messagePattern":"--all and --count are mutually exclusive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/cmd/pulumi/do/do_resource.go","lineNumber":513,"sourceCode":"\t\t},\n\t}\n\tcmd.Flags().BoolVar(&yes, \"yes\", false,\n\t\t\"Automatically approve and perform the operation without a confirmation prompt\")\n\treturn cmd\n}\n\nfunc (pc *packageCommand) newResourceListCommand(res *schema.Resource) *cobra.Command {\n\tvar inputFile string\n\tvar inputFormat string\n\tvar all bool\n\tvar count int64\n\tcmd := &cobra.Command{\n\t\tUse:   \"list\",\n\t\tShort: \"List resources\",\n\t\tArgs:  cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif all && count > 0 {\n\t\t\t\treturn errors.New(\"--all and --count are mutually exclusive\")\n\t\t\t}\n\t\t\tctx := cmd.Context()\n\t\t\tlisting := startSpinner(fmt.Sprintf(\"Listing %s resources\", res.Token))\n\t\t\tdefer listing()\n\t\t\tif err := pc.configureProvider(cmd, ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tquery, err := evaluateResourceListFile(\n\t\t\t\tctx, inputFile, \"input\", inputFormat, res, pc.evalContext(),\n\t\t\t\tpc.converter, pc.loaderTarget, pc.packageDescriptor,\n\t\t\t\tcollectInputFlags(cmd, \"input\", res.ListInputs.Properties))\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"parse input file: %w\", err)\n\t\t\t}\n\n\t\t\tvar results []plugin.ListResult\n\t\t\tvar continuation string","sourceCodeStart":495,"sourceCodeEnd":531,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/cmd/pulumi/do/do_resource.go#L495-L531","documentation":"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.","triggerScenarios":"Invoking `pulumi package <provider> <type> list --all --count 10` (or --count > 0 together with --all) in a script or alias.","commonSituations":"Script variables defaulting --all to true while also passing --count; copying an example and appending an extra flag; wrapper scripts that merge both options.","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."],"exampleFix":"// before\npulumi package do provider bucket list --all --count 10\n// after\npulumi package do provider bucket list --count 10","handlingStrategy":"validation","validationCode":"# shell\nif [ -n \"$ALL\" ] && [ -n \"$COUNT\" ]; then echo \"--all and --count are mutually exclusive\"; exit 2; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","flag-validation","list"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}