{"record":{"id":"7e512621949ec9bf","repo":"phacility/phabricator","slug":"query-s-is-unknown-to-run-a-builtin-query-like","errorCode":null,"errorMessage":"Query \"%s\" is unknown. To run a builtin query like \"all\" or \"active\", also specify the search engine with \"--class\".","messagePattern":"Query \"(.+?)\" is unknown\\. To run a builtin query like \"all\" or \"active\", also specify the search engine with \"--class\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php","lineNumber":233,"sourceCode":"    }\n\n    $queries = array();\n    foreach ($query_keys as $query_key) {\n      if ($engine) {\n        if ($engine->isBuiltinQuery($query_key)) {\n          $queries[$query_key] = $engine->buildSavedQueryFromBuiltin(\n            $query_key);\n          continue;\n        }\n      }\n\n      $saved_query = id(new PhabricatorSavedQueryQuery())\n        ->setViewer($viewer)\n        ->withQueryKeys(array($query_key))\n        ->executeOne();\n      if (!$saved_query) {\n        if (!$engine) {\n          throw new PhutilArgumentUsageException(\n            pht(\n              'Query \"%s\" is unknown. To run a builtin query like \"all\" or '.\n              '\"active\", also specify the search engine with \"--class\".',\n              $query_key));\n        } else {\n          throw new PhutilArgumentUsageException(\n            pht(\n              'Query \"%s\" is not a recognized query for class \"%s\".',\n              $query_key,\n              get_class($engine)));\n        }\n      }\n\n      $queries[$query_key] = $saved_query;\n    }\n\n    // If we don't have an engine from \"--class\", fill it in by looking at the\n    // class of the first query.","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php#L215-L251","documentation":"Each --query key is first looked up among the chosen engine's builtin queries and then among saved queries in the database (PhabricatorSavedQueryQuery). If the key is unknown and no --class was supplied, this usage exception explains that builtin names like 'all' or 'active' need --class to know which engine to use. Without a class, only database-stored saved-query keys can be resolved.","triggerScenarios":"Running `bin/bulk export --query all --output -` with no --class; passing a saved-query key that was deleted or copied from a different install (executeOne returns nothing).","commonSituations":"Copy-pasting '--query all' from documentation without the accompanying --class; stale query keys after someone deleted the saved search; migrating keys between test and prod.","solutions":["Add --class <EngineClassName> so builtin names like all or active resolve against that engine.","Use a real saved query key: run the search in the web UI and copy the queryKey parameter from the URL.","Recreate the deleted saved query in the UI and use its new key."],"exampleFix":"# before\nbin/bulk export --query all --output -\n# after\nbin/bulk export --class ManiphestTaskSearchEngine --query all --output -","handlingStrategy":"validation","validationCode":"# builtin names always need an engine; enforce the pairing\nif [[ \"$QUERY\" == all || \"$QUERY\" == active ]]; then\n  test -n \"$ENGINE_CLASS\" || { echo 'builtin queries require --class' >&2; exit 2; }\nfi","typeGuard":null,"tryCatchPattern":"Catch PhutilArgumentUsageException, detect 'is unknown', and re-emit the hint about --class plus a link to the saved-query UI.","preventionTips":["Pair builtin query names with --class in every script.","Re-verify saved-query keys after data migrations or UI cleanups."],"tags":["phabricator","cli","export","query"],"backgroundTag":"resource-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}