phacility/phabricator · error · Exception

This storage format ("%s") does not support key selection.

Error message

This storage format ("%s") does not support key selection.

What it means

PhabricatorFileStorageFormat::selectMasterKey() is only implemented by key-capable formats (the AES-256 format); the base class throws this Exception for every other format such as 'raw' and 'test'. It means the caller asked a storage format to use a named encryption key when that format has no concept of keys. The correct response is to drop the key argument or target a format that supports keys.

Source

Thrown at src/applications/files/format/PhabricatorFileStorageFormat.php:50

  public function canGenerateNewKeyMaterial() {
    return false;
  }

  public function generateNewKeyMaterial() {
    throw new PhutilMethodNotImplementedException();
  }

  public function canCycleMasterKey() {
    return false;
  }

  public function cycleStorageProperties() {
    throw new PhutilMethodNotImplementedException();
  }

  public function selectMasterKey($key_name) {
    throw new Exception(
      pht(
        'This storage format ("%s") does not support key selection.',
        $this->getStorageFormatName()));
  }

  final public function getStorageFormatKey() {
    return $this->getPhobjectClassConstant('FORMATKEY');
  }

  final public static function getAllFormats() {
    return id(new PhutilClassMapQuery())
      ->setAncestorClass(__CLASS__)
      ->setUniqueMethod('getStorageFormatKey')
      ->execute();
  }

  final public static function getFormat($key) {
    $formats = self::getAllFormats();

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Remove the --key argument when encoding to a keyless format: `./bin/files encode --as raw F123`
  2. Use --as aes-256-cbc if key selection was actually intended
  3. In code, only call selectMasterKey() on formats that implement it (instances of PhabricatorFileAES256StorageFormat)

Example fix

# before
./bin/files encode --as raw --key prod-2024 F123

# after
./bin/files encode --as raw F123
Defensive patterns

Strategy: validation

Validate before calling

$format = PhabricatorFileStorageFormat::requireFormat($format_key);
if (strlen($key_name) && !($format instanceof PhabricatorFileAES256StorageFormat)) {
  // "{$format_key}" has no keys; do not call selectMasterKey() with --key.
}

Type guard

function formatSupportsKeySelection(PhabricatorFileStorageFormat $format) {
  return ($format instanceof PhabricatorFileAES256StorageFormat);
}

Prevention

When it happens

Trigger: Running `./bin/files encode --as raw --key prod-2024 F123` (any --key with a format other than aes-256-cbc); programmatically calling selectMasterKey($name) on a PhabricatorFileRawStorageFormat or any custom format that does not override the method.

Common situations: Copy-pasting the --key flag from an encryption command into a re-encode to a plain format; wrapper scripts that always pass --key regardless of the --as value.

Related errors


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