phacility/phabricator · warning · PhutilArgumentUsageException

Unknown export format

Error message

Unknown export format ("%s"). Known formats are: %s.

What it means

The --format value is looked up in PhabricatorExportFormat::getAllExportFormats(). An unrecognized key aborts and the error enumerates the registered format keys, so the correct keys are always in the message.

Solutions

  1. Use one of the formats listed verbatim in the error message (csv is the always-registered baseline)
  2. Update the script for the current version's registry
  3. If the format comes from an extension, verify the extension is installed and loaded

Example fix

# before
./bin/bulk export --format xml ...

# after: a format the registry actually knows
./bin/bulk export --format csv ...
Defensive patterns

Strategy: validation

Validate before calling

// Check the key against the registry before running the workflow.
$all_formats = PhabricatorExportFormat::getAllExportFormats();
if (!isset($all_formats[$format_key])) {
  $format_key = 'csv'; // or report: known formats are array_keys($all_formats)
}

Prevention

When it happens

Trigger: Passing a typo'd format key or one that does not exist in this install's registry (for example a format provided by an extension that is not loaded).

Common situations: Scripts written against a different Phabricator version whose format registry differs; documentation drift; missing custom export format extensions.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at src/applications/transactions/bulk/management/PhabricatorBulkManagementExportWorkflow.php:63

        ));
  }

  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.',
          $format_key));
    }

    $is_overwrite = $args->getArg('overwrite');
    $output_path = $args->getArg('output');

    if (!strlen($output_path)) {
      throw new PhutilArgumentUsageException(

View on GitHub (pinned to 5720a38cfe)