{"record":{"id":"c66735d8e2531cd0","repo":"phacility/phabricator","slug":"specified-queries-use-different-engines-query-s","errorCode":null,"errorMessage":"Specified queries use different engines: query \"%s\" uses engine \"%s\", not \"%s\". All queries must run on the same engine.","messagePattern":"Specified queries use different engines: query \"(.+?)\" uses engine \"(.+?)\", not \"(.+?)\"\\. All queries must run on the same engine\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php","lineNumber":265,"sourceCode":"      $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      }\n    }\n\n    $engine_class = get_class($engine);\n\n    foreach ($queries as $query) {\n      $query_class = $query->getEngineClassName();\n      if ($query_class !== $engine_class) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Specified queries use different engines: query \"%s\" uses '.\n            'engine \"%s\", not \"%s\". All queries must run on the same '.\n            'engine.',\n            $query->getQueryKey(),\n            $query_class,\n            $engine_class));\n      }\n    }\n\n    if (!$engine->canExport()) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'SearchEngine class (\"%s\") does not support data export.',\n          $engine_class));\n    }\n\n    return array($engine, $queries);","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php#L247-L283","documentation":"A single export run uses one search engine. When multiple --query keys are given, the code takes the first query's engine class (or the --class engine) and throws this usage exception if any later query's getEngineClassName() differs. The union-query path (newUnionQuery, used when count($queries) > 1) also requires all queries to run on one engine, since it merges result IDs into one synthetic query.","triggerScenarios":"Passing --query A --query B where A is a Maniphest saved query and B a Differential saved query; combining keys collected from different applications' UI searches into one invocation.","commonSituations":"Trying to build one combined CSV of tasks and revisions; consolidating several recurring exports into a single command during cleanup.","solutions":["Split the invocation per application: one command per engine with only that engine's query keys, then merge the files downstream.","Pin --class explicitly and audit that every --query key belongs to that engine before running.","To union results inside one application, pass several saved queries from that same application."],"exampleFix":"# before (keys belong to different engines)\nbin/bulk export --query ${TASK_KEY} --query ${REVISION_KEY} --output -\n# after (one engine per invocation)\nbin/bulk export --query ${TASK_KEY} --output tasks.csv\nbin/bulk export --class DifferentialRevisionSearchEngine --query ${REVISION_KEY} --output revs.csv","handlingStrategy":"validation","validationCode":"# group saved-query keys per engine before invoking\nfor engine in \"${!KEYS_BY_ENGINE[@]}\"; do\n  bin/bulk export --class \"$engine\" \"${KEYS_BY_ENGINE[$engine]}\" --output \"out-$engine.csv\"\ndone","typeGuard":null,"tryCatchPattern":"Catch PhutilArgumentUsageException, detect 'use different engines', and split the invocation automatically per engine class before retrying once.","preventionTips":["Keep one engine per export invocation.","Store query keys keyed by engine class in configuration so grouping is explicit."],"tags":["phabricator","cli","export","query"],"backgroundTag":"invalid-argument-combination","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}