phacility/phabricator · error · Exception

Sound ("%s") is not a valid sound.

Error message

Sound ("%s") is not a valid sound.

What it means

Thrown by assertValidRuleRecordValue() for the 'sound' rule when the stored value is not a key of PhabricatorProjectTriggerPlaySoundRule::getSoundMap(). The rule names a sound effect this install does not know. Validation runs when the trigger is saved and when stored rules are re-validated.

Source

Thrown at src/applications/project/trigger/PhabricatorProjectTriggerPlaySoundRule.php:24

  const TRIGGERTYPE = 'sound';

  public function getSelectControlName() {
    return pht('Play sound');
  }

  protected function assertValidRuleRecordFormat($value) {
    if (!is_string($value)) {
      throw new Exception(
        pht(
          'Status rule value should be a string, but is not (value is "%s").',
          phutil_describe_type($value)));
    }
  }

  protected function assertValidRuleRecordValue($value) {
    $map = self::getSoundMap();
    if (!isset($map[$value])) {
      throw new Exception(
        pht(
          'Sound ("%s") is not a valid sound.',
          $value));
    }
  }

  protected function newDropTransactions($object, $value) {
    return array();
  }

  protected function newDropEffects($value) {
    $sound_icon = 'fa-volume-up';
    $sound_color = 'blue';
    $sound_name = self::getSoundName($value);

    $content = pht(
      'Play sound %s.',
      phutil_tag('strong', array(), $sound_name));

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pick the sound again from the trigger editor dropdown so a valid key is stored.
  2. Check the installed version's getSoundMap() for the available keys and use one of those.
  3. If migrating between versions, remap removed sound keys to existing ones in phabricator_project_trigger_rule_record.
  4. Audit all type='sound' records for invalid keys.

Example fix

// before (key not in getSoundMap())
$value = 'gong';

// after (key defined by getSoundMap())
$value = 'bing';
Defensive patterns

Strategy: validation

Validate before calling

// Reflection is not available publicly; snapshot keys from the editor dropdown
// and validate against that list before saving programmatically.
if (!in_array($value, $known_sound_keys, true)) {
  throw new Exception('Unknown sound key: '.$value);
}

Type guard

function isValidSoundKey($value, array $known_sound_keys) {
  return is_string($value) && in_array($value, $known_sound_keys, true);
}

Try / catch

$ex = $rule->getRuleRecordValueValidationException();
if ($ex) { /* prompt to re-pick sound from dropdown */ }

Prevention

When it happens

Trigger: A 'sound' rule stores a key that getSoundMap() does not define (invented key, or a key removed in a different Phorge version). Saving the trigger or re-validating stored rules throws 'Sound ("x") is not a valid sound.'

Common situations: Cross-version migration: trigger created on a version with a larger sound map; hand-written record with a guessed key; custom map changed by an extension.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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