{"record":{"id":"42556123211d1405","repo":"phacility/phabricator","slug":"you-can-not-use-query-constraint-flags-like-ve","errorCode":null,"errorMessage":"You can not use query constraint flags (like \"--version\", \"--type\", or a list of specific objects) with \"--all\".","messagePattern":"You can not use query constraint flags \\(like \"--version\", \"--type\", or a list of specific objects\\) with \"--all\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php","lineNumber":103,"sourceCode":"      $min_epoch = $this->parseTimeArgument($min_epoch);\n    }\n\n    $max_epoch = $args->getArg('max-index-date');\n    if ($max_epoch !== null) {\n      $max_epoch = $this->parseTimeArgument($max_epoch);\n    }\n\n    $object_names = $args->getArg('objects');\n\n    $any_constraints =\n      ($object_names) ||\n      ($object_types) ||\n      ($index_versions) ||\n      ($min_epoch) ||\n      ($max_epoch);\n\n    if ($is_all && $any_constraints) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'You can not use query constraint flags (like \"--version\", '.\n          '\"--type\", or a list of specific objects) with \"--all\".'));\n    }\n\n    if (!$is_all && !$any_constraints) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Provide a list of objects to index (like \"D123\"), or a set of '.\n          'query constraint flags (like \"--type\"), or \"--all\" to index '.\n          'all objects.'));\n    }\n\n\n    if ($args->getArg('background')) {\n      $is_background = true;\n    } else {\n      PhabricatorWorker::setRunAllTasksInProcess(true);","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php#L85-L121","documentation":"Usage exception from `bin/search index`: the --all flag and any query constraint are mutually exclusive. The workflow computes $any_constraints from positional object names, --type, --version, --min-index-date, or --max-index-date, and refuses to run when --all is also given, because --all already fully defines the document set.","triggerScenarios":"Commands like `bin/search index --all --type task`, `bin/search index --all D123`, `bin/search index --all --version 3`, or `bin/search index --all --min-index-date 2020-01-01`.","commonSituations":"Scripts written against older workflows that allowed combining --all with filters; copy-pasting examples and appending --all 'to be safe'; attempting 'reindex everything of one type' by adding --all.","solutions":["Drop --all and keep the constraints: `bin/search index --type task`","Or drop the constraints to index everything: `bin/search index --all`","For 'all objects of a type', --type alone already selects the full set for that type","Run `bin/search help index` to confirm the current flag semantics"],"exampleFix":"# before\nbin/search index --all --type task\n\n# after\nbin/search index --type task","handlingStrategy":"validation","validationCode":"// Before shelling out, enforce the exclusivity the workflow enforces\n$isAll = !empty($args['all']);\n$hasConstraints = !empty($args['objects']) || !empty($args['type'])\n  || !empty($args['version']) || !empty($args['min-index-date'])\n  || !empty($args['max-index-date']);\nif ($isAll && $hasConstraints) {\n  // choose one mode; do not invoke bin/search index\n}","typeGuard":null,"tryCatchPattern":"try {\n  $workflow->execute($args);\n} catch (PhutilArgumentUsageException $ex) {\n  // fix the invocation; the message names the conflicting flags\n}","preventionTips":["Treat --all as exclusive; never combine it with filters or object names","Check exit codes on scripted bin/search calls","Re-read `bin/search help index` after upgrades"],"tags":["cli","bin-search","usage-error","argument-conflict"],"backgroundTag":"mutually-exclusive-cli-flags","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}