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

  1. Pass a known format key: ./bin/bulk export --format csv ...
  2. Default the format variable in wrapper scripts so it is never empty
  3. 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

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


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/7c71a5e16b2ede9b. Report an issue: GitHub.