phacility/phabricator · warning · PhutilArgumentUsageException

Storage format "%s" is not valid. Available formats are: %s.

Error message

Storage format "%s" is not valid. Available formats are: %s.

What it means

The encode workflow resolves --as through PhabricatorFileStorageFormat::getFormat(), which maps registered FORMATKEY constants to classes; when the lookup misses, this usage error is thrown along with the list of available format keys. It means the requested format key is misspelled or its class is not loaded on this install.

Source

Thrown at src/applications/files/management/PhabricatorFilesManagementEncodeWorkflow.php:55

    $force = (bool)$args->getArg('force');

    $format_list = PhabricatorFileStorageFormat::getAllFormats();
    $format_list = array_keys($format_list);
    $format_list = implode(', ', $format_list);

    $format_key = $args->getArg('as');
    if (!strlen($format_key)) {
      throw new PhutilArgumentUsageException(
        pht(
          'Use --as <format> to select a target encoding format. Available '.
          'formats are: %s.',
          $format_list));
    }

    $format = PhabricatorFileStorageFormat::getFormat($format_key);
    if (!$format) {
      throw new PhutilArgumentUsageException(
        pht(
          'Storage format "%s" is not valid. Available formats are: %s.',
          $format_key,
          $format_list));
    }

    $key_name = $args->getArg('key');
    if (strlen($key_name)) {
      $format->selectMasterKey($key_name);
    }

    $engines = PhabricatorFileStorageEngine::loadAllEngines();

    $failed = array();
    foreach ($iterator as $file) {
      $monogram = $file->getMonogram();

      $engine_key = $file->getStorageEngine();

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Copy a key exactly from the list printed in the error message (typically raw, test, aes-256-cbc plus module formats)
  2. If a custom format was expected, enable the module/library that defines its class on this install and retry

Example fix

# before
./bin/files encode --as aes-256 F123

# after
./bin/files encode --as aes-256-cbc F123
Defensive patterns

Strategy: validation

Validate before calling

// Programmatic guard before running the workflow:
if (PhabricatorFileStorageFormat::getFormat($format_key) === null) {
  // "{$format_key}" is not registered here; pick from
  // array_keys(PhabricatorFileStorageFormat::getAllFormats()).
}

Type guard

function isValidStorageFormatKey($key) {
  return array_key_exists($key, PhabricatorFileStorageFormat::getAllFormats());
}

Prevention

When it happens

Trigger: `--as aes-256` (missing -cbc), `--as AES-256-CBC` (case), or a module-provided format key on an install where that module is not enabled.

Common situations: Typos in scripts; referencing a custom storage format that exists only on another environment; formats renamed upstream.

Related errors


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