phacility/phabricator · error · PhutilArgumentUsageException
Query "%s" is not a recognized query for class "%s".
Error message
Query "%s" is not a recognized query for class "%s".
What it means
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.
Source
Thrown at src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php:239
$queries[$query_key] = $engine->buildSavedQueryFromBuiltin(
$query_key);
continue;
}
}
$saved_query = id(new PhabricatorSavedQueryQuery())
->setViewer($viewer)
->withQueryKeys(array($query_key))
->executeOne();
if (!$saved_query) {
if (!$engine) {
throw new PhutilArgumentUsageException(
pht(
'Query "%s" is unknown. To run a builtin query like "all" or '.
'"active", also specify the search engine with "--class".',
$query_key));
} else {
throw new PhutilArgumentUsageException(
pht(
'Query "%s" is not a recognized query for class "%s".',
$query_key,
get_class($engine)));
}
}
$queries[$query_key] = $saved_query;
}
// If we don't have an engine from "--class", fill it in by looking at the
// class of the first query.
if (!$engine) {
foreach ($queries as $query) {
$engine = newv($query->getEngineClassName(), array())
->setViewer($viewer);
break;
}View on GitHub (pinned to 5720a38cfe)
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.
Example fix
# before bin/bulk export --class ManiphestTaskSearchEngine --query open --output - # after bin/bulk export --class ManiphestTaskSearchEngine --query active --output -
Defensive patterns
Strategy: validation
Validate before calling
# before scripting, resolve the key once and fail loudly on failure
bin/bulk export --class "$ENGINE_CLASS" --query "$QUERY" --output /dev/null || {
echo "query '$QUERY' is not valid for $ENGINE_CLASS" >&2; exit 2;
} Try / catch
Catch PhutilArgumentUsageException, match 'is not a recognized query for class', and print the engine's builtin query names next to the failure.
Prevention
- 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.
When it happens
Trigger: `--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').
Common situations: Mixing query keys between applications; typos in builtin names; a cron export referencing a saved query its owner deleted.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Specify one or more queries to export with "--query".
- Query "%s" is unknown. To run a builtin query like "all" or
- Specified queries use different engines: query "%s" uses eng
- Use "--output <path>" to specify an output file, or "--outpu
- Flag "--overwrite" has no effect when outputting to stdout.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/6c91f1660ada9a1b.
Report an issue: GitHub.