phacility/phabricator · error · Exception

Unknown export format ("%s").

Error message

Unknown export format ("%s").

What it means

Thrown by the export bulk worker when the job's 'formatKey' parameter does not map to any registered export format. Formats are discovered with PhabricatorExportFormat::getAllExportFormats(), a class-map query over subclasses of PhabricatorExportFormat keyed by getExportFormatKey(); if idx() on that map misses, the key is unknown to this install.

Source

Thrown at src/infrastructure/export/engine/PhabricatorExportEngineBulkJobType.php:89

        ->withQueryKeys(array($query_key))
        ->executeOne();
    } else {
      $saved_query = null;
    }

    if (!$saved_query) {
      throw new Exception(
        pht(
          'Failed to load saved query ("%s").',
          $query_key));
    }

    $format_key = $job->getParameter('formatKey');

    $all_formats = PhabricatorExportFormat::getAllExportFormats();
    $format = idx($all_formats, $format_key);
    if (!$format) {
      throw new Exception(
        pht(
          'Unknown export format ("%s").',
          $format_key));
    }

    if (!$format->isExportFormatEnabled()) {
      throw new Exception(
        pht(
          'Export format ("%s") is not enabled.',
          $format_key));
    }

    $export_engine = id(new PhabricatorExportEngine())
      ->setViewer($actor)
      ->setTitle($job->getParameter('title'))
      ->setFilename($job->getParameter('filename'))
      ->setSearchEngine($engine)
      ->setSavedQuery($saved_query)

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Re-run the export from the UI and pick a currently offered format (csv, json, txt are always registered)
  2. Check the spelling of formatKey against array_keys(PhabricatorExportFormat::getAllExportFormats())
  3. If a custom format is expected, confirm its class is installed and its getExportFormatKey() returns the key being used
  4. Discard stale queued jobs that were created before a format was removed

Example fix

// before
$job->setParameter('formatKey', $format_key);

// after: validate the key against registered formats before queueing
$formats = PhabricatorExportFormat::getAllExportFormats();
if (empty($formats[$format_key])) {
  throw new Exception(
    pht('Unknown format key "%s". Available: %s.',
      $format_key, implode(', ', array_keys($formats))));
}
$job->setParameter('formatKey', $format_key);
Defensive patterns

Strategy: validation

Validate before calling

$formats = PhabricatorExportFormat::getAllExportFormats();
if (!isset($formats[$format_key])) {
  throw new Exception(pht(
    'Unknown export format "%s". Choose one of: %s.',
    $format_key, implode(', ', array_keys($formats))));
}
$job->setParameter('formatKey', $format_key);

Prevention

When it happens

Trigger: Queueing a job with formatKey that is null, misspelled, or refers to a format class not loaded (e.g. a custom export format extension that is disabled or removed); a job queued under an older Phabricator version referencing a format key that no longer exists when the worker finally runs after an upgrade.

Common situations: Version upgrades renaming/removing format keys; third-party format extensions uninstalled while old queued jobs still reference their key; hand-crafted worker job parameters.

Related errors


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