{"record":{"id":"338b782a33bf6ac6","repo":"phacility/phabricator","slug":"provide-a-list-of-objects-to-index-like-d123","errorCode":null,"errorMessage":"Provide a list of objects to index (like \"D123\"), or a set of query constraint flags (like \"--type\"), or \"--all\" to index all objects.","messagePattern":"Provide a list of objects to index \\(like \"D123\"\\), or a set of query constraint flags \\(like \"--type\"\\), or \"--all\" to index all objects\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php","lineNumber":110,"sourceCode":"\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);\n      $is_background = false;\n    }\n\n    if (!$is_background) {\n      $this->logInfo(\n        pht('NOTE'),\n        pht(","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/search/management/PhabricatorSearchManagementIndexWorkflow.php#L92-L128","documentation":"Usage exception from `bin/search index`: no document selector was supplied. The workflow requires either positional object names, at least one constraint flag (--type, --version, --min-index-date, --max-index-date), or --all. A bare invocation is ambiguous - it could mean 'everything', which is expensive - so it fails fast instead of guessing.","triggerScenarios":"Running `bin/search index` with no arguments and no flags, or a script whose variable expansion produced an empty argument list.","commonSituations":"Exploring the CLI; assumptions that bare `bin/search index` reindexes everything (older behavior in some forks/scripts); truncated or misquoted shell commands in cron.","solutions":["Name objects explicitly: `bin/search index D123 T456`","Or constrain by type: `bin/search index --type task`","Or index everything: `bin/search index --all` (slow on large installs)","Combine constraints such as `--type task --min-index-date` for batched runs"],"exampleFix":"# before\nbin/search index\n\n# after\nbin/search index --type task","handlingStrategy":"validation","validationCode":"$isAll = !empty($args['all']);\n$hasSelector = !empty($args['objects']) || !empty($args['type'])\n  || !empty($args['version']) || !empty($args['min-index-date'])\n  || !empty($args['max-index-date']);\nif (!$isAll && !$hasSelector) {\n  // refuse before invoking: require an explicit selector\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an explicit selector (names, --type, or --all)","In cron jobs, pin the exact command and test it after Phabricator upgrades","Fail scripts early when a computed selector list is empty"],"tags":["cli","bin-search","usage-error","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}