phacility/phabricator · warning · PhutilArgumentUsageException
Specify an export format with "--format".
Error message
Specify an export format with "--format".
What it means
PhabricatorBulkManagementExportWorkflow (bin/bulk export) requires --format to select the export format. An empty value aborts before the format registry is even consulted.
Source
Thrown at src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php:55
'stdout.'),
),
array(
'name' => 'overwrite',
'help' => pht(
'If the output file already exists, overwrite it instead of '.
'raising an error.'),
),
));
}
public function execute(PhutilArgumentParser $args) {
$viewer = $this->getViewer();
list($engine, $queries) = $this->newQueries($args);
$format_key = $args->getArg('format');
if (!strlen($format_key)) {
throw new PhutilArgumentUsageException(
pht(
'Specify an export format with "--format".'));
}
$all_formats = PhabricatorExportFormat::getAllExportFormats();
$format = idx($all_formats, $format_key);
if (!$format) {
throw new PhutilArgumentUsageException(
pht(
'Unknown export format ("%s"). Known formats are: %s.',
$format_key,
implode(', ', array_keys($all_formats))));
}
if (!$format->isExportFormatEnabled()) {
throw new PhutilArgumentUsageException(
pht(
'Export format ("%s") is not enabled.',View on GitHub (pinned to 5720a38cfe)
Solutions
- Pass a known format key: ./bin/bulk export --format csv ...
- Default the format variable in wrapper scripts so it is never empty
- Run with an invalid non-empty key once to see the known-formats list in the sibling error
Example fix
# before ./bin/bulk export --query ... --output out.csv # after ./bin/bulk export --format csv --query ... --output out.csv
Defensive patterns
Strategy: validation
Validate before calling
# bash: default the format so it is never empty
FORMAT="${FORMAT:-csv}"
./bin/bulk export --format "$FORMAT" --query "$QUERY" --output out.csv Prevention
- Always pass --format explicitly in scripts
- Fail fast in wrappers when the format variable is empty
When it happens
Trigger: Running ./bin/bulk export without --format, or with an empty string as its value, typically when a script's format variable was never set.
Common situations: Wrapper scripts where the format is conditionally assigned; copy-pasting an export command from docs that omitted the flag.
Related errors
- Unknown export format ("%s"). Known formats are: %s.
- Export format ("%s") is not enabled.
- You must specify the path to a public keyfile with %s.
- You must specify the path to a pkcs8 keyfile with %s.
- You must specify the username of the account to recover.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/7c71a5e16b2ede9b.
Report an issue: GitHub.