phacility/phabricator · warning · PhutilArgumentUsageException

Storage type "%s" is unknown. Supported types are: %s.

Error message

Storage type "%s" is unknown. Supported types are: %s.

What it means

migrate-hunk validates the --to value against the supported hunk storage datatypes, which are exactly DifferentialHunk::DATATYPE_TEXT ('text') and DifferentialHunk::DATATYPE_FILE ('file'). Any other string throws this usage exception listing the accepted values, so the check runs before any hunk is read or written.

Source

Thrown at src/applications/differential/management/PhabricatorDifferentialMigrateHunkWorkflow.php:80

        pht(
          'Options "--to" (to choose a specific storage format) and "--auto" '.
          '(to select a storage format automatically) are mutually '.
          'exclusive.'));
    } else if (!$is_auto && !$storage) {
      throw new PhutilArgumentUsageException(
        pht(
          'Use "--to" to choose a storage format, or "--auto" to select a '.
          'format automatically.'));
    }

    $types = array(
      DifferentialHunk::DATATYPE_TEXT,
      DifferentialHunk::DATATYPE_FILE,
    );
    $types = array_fuse($types);
    if (strlen($storage)) {
      if (!isset($types[$storage])) {
        throw new PhutilArgumentUsageException(
          pht(
            'Storage type "%s" is unknown. Supported types are: %s.',
            $storage,
            implode(', ', array_keys($types))));
      }
    }

    if ($id) {
      $hunk = $this->loadHunk($id);
      $hunks = array($hunk);
    } else {
      $hunks = new LiskMigrationIterator(new DifferentialHunk());
    }

    foreach ($hunks as $hunk) {
      try {
        $this->migrateHunk($hunk, $storage, $is_auto, $is_dry_run);
      } catch (Exception $ex) {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use exactly one of the two listed values: --to text or --to file
  2. If unsure which to pick, use --auto instead of --to and let Phabricator choose
  3. Print the supported types from the error message itself; they are authoritative for your installed version
  4. Fix the script variable that produced the bad token (quote it and default it)

Example fix

# before
phabricator/ $ ./bin/differential migrate-hunk --all --to gzip
Usage Exception: Storage type "gzip" is unknown. Supported types are: text, file.

# after
phabricator/ $ ./bin/differential migrate-hunk --all --to file
Defensive patterns

Strategy: validation

Validate before calling

// Validate the storage type against the supported set before invoking
$supported = array(DifferentialHunk::DATATYPE_TEXT, DifferentialHunk::DATATYPE_FILE); // 'text', 'file'
if (!in_array($to_format, $supported, true)) {
  throw new Exception('Use --to text, --to file, or --auto.');
}

Type guard

function isValidHunkStorageType($type) {
  return in_array($type, array('text', 'file'), true);
}

Try / catch

try {
  $workflow->execute($args);
} catch (PhutilArgumentUsageException $ex) {
  // Unknown storage type: the message lists the accepted values for this
  // installed version; pick one (or --auto) and re-run.
}

Prevention

When it happens

Trigger: Passing --to with an invented or misremembered value (e.g., 'mysql', 's3', 'files', 'gzip', 'database'); passing the data-format name instead of the datatype (formats like 'gzip' are not storage types); typos or shell-expansion artifacts in the argument.

Common situations: Operators confusing the hunk 'data type' (where bytes live: database text vs file storage) with the 'data format' (compression/encoding of the bytes); scripts copied from older or newer versions whose supported lists differ; uninitialized FORMAT variables expanding to an empty or wrong token.

Related errors


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