{"record":{"id":"c535f7239a54f628","repo":"phacility/phabricator","slug":"unknown-condition-s","errorCode":null,"errorMessage":"Unknown condition '%s'.","messagePattern":"Unknown condition '(.+?)'\\.","errorType":"validation","errorClass":"HeraldInvalidConditionException","httpStatus":null,"severity":"error","filePath":"src/applications/herald/adapter/HeraldAdapter.php","lineNumber":608,"sourceCode":"      case self::CONDITION_NOT_RULE:\n        $rule = $engine->getRule($condition_value);\n        if (!$rule) {\n          throw new HeraldInvalidConditionException(\n            pht('Condition references a rule which does not exist!'));\n        }\n\n        $is_not = ($condition_type == self::CONDITION_NOT_RULE);\n        $result = $engine->doesRuleMatch($rule, $this);\n        if ($is_not) {\n          $result = !$result;\n        }\n        return $result;\n      case self::CONDITION_HAS_BIT:\n        return (($condition_value & $field_value) === (int)$condition_value);\n      case self::CONDITION_NOT_BIT:\n        return (($condition_value & $field_value) !== (int)$condition_value);\n      default:\n        throw new HeraldInvalidConditionException(\n          pht(\"Unknown condition '%s'.\", $condition_type));\n    }\n  }\n\n  public function willSaveCondition(HeraldCondition $condition) {\n    $condition_type = $condition->getFieldCondition();\n    $condition_value = $condition->getValue();\n\n    switch ($condition_type) {\n      case self::CONDITION_REGEXP:\n      case self::CONDITION_NOT_REGEXP:\n        $ok = @preg_match($condition_value, '');\n        if ($ok === false) {\n          throw new HeraldInvalidConditionException(\n            pht(\n              'The regular expression \"%s\" is not valid. Regular expressions '.\n              'must have enclosing characters (e.g. \"@/path/to/file@\", not '.\n              '\"/path/to/file\") and be syntactically correct.',","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/herald/adapter/HeraldAdapter.php#L590-L626","documentation":"doesConditionMatch() switches over the known CONDITION_* constants; any condition whose stored field-condition constant matches no case falls through to default and throws HeraldInvalidConditionException(\"Unknown condition '%s'.\"). The stored constant is not one this adapter/engine version recognizes.","triggerScenarios":"A herald_condition row stores an arbitrary/unknown condition constant — hand-edited data, a condition defined by an extension that is no longer installed, or a database moved between Phabricator versions with different condition sets.","commonSituations":"Disabling/uninstalling an application or extension that contributed custom Herald conditions while rules still use them; manual DB edits; partial or failed upgrades leaving rows in an inconsistent state.","solutions":["Inspect the rule's conditions in the Herald UI and re-save the rule to normalize them, or delete the broken condition.","If an extension's condition is involved, reinstall/enable the extension or remove the condition that uses it.","Find the offending row (herald_condition, fieldName/fieldCondition) and correct or delete it, then re-evaluate the rule."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate stored condition constants against the adapter's known set:\n$valid = $adapter->getConditionConstants(); // known CONDITION_* values\nif (!in_array($condition->getFieldCondition(), $valid, true)) {\n  // unknown constant - fix or delete the condition row\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit herald_condition constants; use the UI.","Before uninstalling an extension that adds Herald conditions, remove rules using them."],"tags":["herald","condition","phabricator"],"backgroundTag":"invalid-enum-value","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}