phacility/phabricator · warning · PhutilArgumentUsageException
You can not specify both "--active" and "--archived" tasks:
Error message
You can not specify both "--active" and "--archived" tasks: no tasks can match both constraints.
What it means
Thrown by Phabricator's worker management workflows (`bin/worker ...`) when the command line supplies both `--active` and `--archived` at the same time. A task exists in exactly one of the two tables (active vs archived), so the two flags produce an empty, contradictory selection and Phabricator refuses to run rather than silently affecting nothing. It is a PhutilArgumentUsageException raised during constraint parsing, before any query executes.
Source
Thrown at src/infrastructure/daemon/workers/management/PhabricatorWorkerManagementWorkflow.php:98
$min_priority = $args->getArg('min-priority');
$max_priority = $args->getArg('max-priority');
$limit = $args->getArg('limit');
$any_constraints = false;
if ($ids) {
$any_constraints = true;
}
if ($class) {
$any_constraints = true;
}
if ($active || $archived) {
$any_constraints = true;
if ($active && $archived) {
throw new PhutilArgumentUsageException(
pht(
'You can not specify both "--active" and "--archived" tasks: '.
'no tasks can match both constraints.'));
}
}
if ($container_names) {
$any_constraints = true;
$container_phids = $this->loadObjectPHIDsFromArguments($container_names);
} else {
$container_phids = array();
}
if ($object_names) {
$any_constraints = true;
$object_phids = $this->loadObjectPHIDsFromArguments($object_names);
} else {
$object_phids = array();View on GitHub (pinned to 5720a38cfe)
Solutions
- Pass only one of the two flags: `--active` for queued/leased tasks, `--archived` for completed or failed tasks
- Omit both flags to search both sets when combined with other constraints like `--id` or `--class`
- Audit wrapper scripts that build the flag list dynamically and guard against emitting both
Example fix
# before ./bin/worker retry --active --archived --class PhabricatorMailerWorker # after ./bin/worker retry --archived --class PhabricatorMailerWorker
Defensive patterns
Strategy: validation
Validate before calling
$flags = array();
if ($include_active) { $flags[] = '--active'; }
if ($include_archived) { $flags[] = '--archived'; }
if ($include_active && $include_archived) {
throw new InvalidArgumentException(
'--active and --archived are mutually exclusive');
}
$cmd = './bin/worker '.implode(' ', array_merge([$subcommand], $flags)); Prevention
- Model the two flags as a single tri-state selector ('active'|'archived'|'both') in wrapper scripts so both can never be emitted
- Keep a reviewed library of worker commands rather than ad-hoc concatenation
When it happens
Trigger: Any invocation such as `./bin/worker retry --active --archived --class SomeTaskClass`, `./bin/worker archive --active --archived`, or `--id 5 --active --archived`. Both flags set to true (even as `--active --archived` with no values) triggers it.
Common situations: Copy-pasting a previously working command and appending flags without removing the old one; scripts that concatenate optional flags into one string and end up including both; operators assuming `--active --archived` means 'everything'.
Related errors
- Specify either "--all" or "--caches", not both.
- Options "--all" (to migrate all hunks) and "--id" (to migrat
- Options "--to" (to choose a specific storage format) and "--
- Specify --service or --remove-service, but not both.
- Specify either "--start" or "--stop", but not both.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/0e6b00093cdf3d4d.
Report an issue: GitHub.