phacility/phabricator · warning · PhutilArgumentUsageException
Specify an export format with "--format".
Error message
Specify an export format with "--format".
What it means
Usage guard in the bulk export CLI workflow: fires when the --format argument is an empty string, so no export engine (CSV, JSON, etc.) can be selected. The check runs after queries are built but before any output file or stdout stream is written.
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.
Understand the failure class
Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.
Related errors
- Export format (" ") is not enabled.
- Unknown export format
- Choose a policy with
- Choose which capabilities to unlock with "--view"…
- Flag "--overwrite" has no effect when outputting to stdout.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/7c71a5e16b2ede9b.
Report an issue: GitHub.
Appendix: 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)