{"record":{"id":"6c91f1660ada9a1b","repo":"phacility/phabricator","slug":"query-s-is-not-a-recognized-query-for-class-s","errorCode":null,"errorMessage":"Query \"%s\" is not a recognized query for class \"%s\".","messagePattern":"Query \"(.+?)\" is not a recognized query for class \"(.+?)\"\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php","lineNumber":239,"sourceCode":"          $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.\n    if (!$engine) {\n      foreach ($queries as $query) {\n        $engine = newv($query->getEngineClassName(), array())\n          ->setViewer($viewer);\n        break;\n      }","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php#L221-L257","documentation":"Same lookup as the unknown-query case, but here a --class was given: the key is neither a builtin query of that engine (buildSavedQueryFromBuiltin returned nothing) nor a saved query associated with it. The message names the engine class so you can tell which engine rejected the key. Saved queries remember their own engine class, so a key belonging to another engine never resolves here.","triggerScenarios":"`--class ManiphestTaskSearchEngine --query <key>` where <key> is a saved query from a different application, or a misspelled builtin name (e.g. 'open' when the engine defines 'active').","commonSituations":"Mixing query keys between applications; typos in builtin names; a cron export referencing a saved query its owner deleted.","solutions":["Use one of the engine's builtin query names (visible in the engine class's buildSavedQueryFromBuiltin, e.g. all, active).","Copy the saved query key from the web UI URL of a search in that same application.","Drop --class and pass only the saved query key — the engine is then inferred from the saved query's own engine class."],"exampleFix":"# before\nbin/bulk export --class ManiphestTaskSearchEngine --query open --output -\n# after\nbin/bulk export --class ManiphestTaskSearchEngine --query active --output -","handlingStrategy":"validation","validationCode":"# before scripting, resolve the key once and fail loudly on failure\nbin/bulk export --class \"$ENGINE_CLASS\" --query \"$QUERY\" --output /dev/null || {\n  echo \"query '$QUERY' is not valid for $ENGINE_CLASS\" >&2; exit 2;\n}","typeGuard":null,"tryCatchPattern":"Catch PhutilArgumentUsageException, match 'is not a recognized query for class', and print the engine's builtin query names next to the failure.","preventionTips":["Verify query keys against the same application's UI before scheduling.","Prefer builtin names (all, active) for long-lived scripts since saved keys can be deleted."],"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"}