{"record":{"id":"cd132ca21408934f","repo":"phacility/phabricator","slug":"sound-s-is-not-a-valid-sound","errorCode":null,"errorMessage":"Sound (\"%s\") is not a valid sound.","messagePattern":"Sound \\(\"(.+?)\"\\) is not a valid sound\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/project/trigger/PhabricatorProjectTriggerPlaySoundRule.php","lineNumber":24,"sourceCode":"  const TRIGGERTYPE = 'sound';\n\n  public function getSelectControlName() {\n    return pht('Play sound');\n  }\n\n  protected function assertValidRuleRecordFormat($value) {\n    if (!is_string($value)) {\n      throw new Exception(\n        pht(\n          'Status rule value should be a string, but is not (value is \"%s\").',\n          phutil_describe_type($value)));\n    }\n  }\n\n  protected function assertValidRuleRecordValue($value) {\n    $map = self::getSoundMap();\n    if (!isset($map[$value])) {\n      throw new Exception(\n        pht(\n          'Sound (\"%s\") is not a valid sound.',\n          $value));\n    }\n  }\n\n  protected function newDropTransactions($object, $value) {\n    return array();\n  }\n\n  protected function newDropEffects($value) {\n    $sound_icon = 'fa-volume-up';\n    $sound_color = 'blue';\n    $sound_name = self::getSoundName($value);\n\n    $content = pht(\n      'Play sound %s.',\n      phutil_tag('strong', array(), $sound_name));","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/project/trigger/PhabricatorProjectTriggerPlaySoundRule.php#L6-L42","documentation":"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.","triggerScenarios":"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.'","commonSituations":"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.","solutions":["Pick the sound again from the trigger editor dropdown so a valid key is stored.","Check the installed version's getSoundMap() for the available keys and use one of those.","If migrating between versions, remap removed sound keys to existing ones in phabricator_project_trigger_rule_record.","Audit all type='sound' records for invalid keys."],"exampleFix":"// before (key not in getSoundMap())\n$value = 'gong';\n\n// after (key defined by getSoundMap())\n$value = 'bing';","handlingStrategy":"validation","validationCode":"// Reflection is not available publicly; snapshot keys from the editor dropdown\n// and validate against that list before saving programmatically.\nif (!in_array($value, $known_sound_keys, true)) {\n  throw new Exception('Unknown sound key: '.$value);\n}","typeGuard":"function isValidSoundKey($value, array $known_sound_keys) {\n  return is_string($value) && in_array($value, $known_sound_keys, true);\n}","tryCatchPattern":"$ex = $rule->getRuleRecordValueValidationException();\nif ($ex) { /* prompt to re-pick sound from dropdown */ }","preventionTips":["Pick sounds from the trigger editor list; do not free-type keys.","After version upgrades, re-save sound rules that reference old keys.","Keep a canonical list of valid sounds when scripting trigger creation."],"tags":["php","phabricator","project-triggers","sound-rule","invalid-enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}