{"record":{"id":"cb8c24fe222a9a12","repo":"phacility/phabricator","slug":"dangerous-change-s-dangerous-change-protection-i","errorCode":null,"errorMessage":"DANGEROUS CHANGE: %s\nDangerous change protection is enabled for this repository.\nEdit the repository configuration before making dangerous changes.","messagePattern":"DANGEROUS CHANGE: (.+?)\nDangerous change protection is enabled for this repository\\.\nEdit the repository configuration before making dangerous changes\\.","errorType":"exception","errorClass":"DiffusionCommitHookRejectException","httpStatus":null,"severity":"error","filePath":"src/applications/diffusion/engine/DiffusionCommitHookEngine.php","lineNumber":295,"sourceCode":"\n    $flag_dangerous = PhabricatorRepositoryPushLog::CHANGEFLAG_DANGEROUS;\n\n    foreach ($ref_updates as $ref_update) {\n      if (!$ref_update->hasChangeFlags($flag_dangerous)) {\n        // This is not a dangerous change.\n        continue;\n      }\n\n      // We either have a branch deletion or a non fast-forward branch update.\n      // Format a message and reject the push.\n\n      $message = pht(\n        \"DANGEROUS CHANGE: %s\\n\".\n        \"Dangerous change protection is enabled for this repository.\\n\".\n        \"Edit the repository configuration before making dangerous changes.\",\n        $ref_update->getDangerousChangeDescription());\n\n      throw new DiffusionCommitHookRejectException($message);\n    }\n  }\n\n  private function findContentUpdates(array $ref_updates) {\n    assert_instances_of($ref_updates, 'PhabricatorRepositoryPushLog');\n\n    $type = $this->getRepository()->getVersionControlSystem();\n    switch ($type) {\n      case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:\n        return $this->findGitContentUpdates($ref_updates);\n      case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:\n        return $this->findMercurialContentUpdates($ref_updates);\n      case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:\n        return $this->findSubversionContentUpdates($ref_updates);\n      default:\n        throw new Exception(pht('Unsupported repository type \"%s\"!', $type));\n    }\n  }","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/diffusion/engine/DiffusionCommitHookEngine.php#L277-L313","documentation":"Error \"DANGEROUS CHANGE: %s\nDangerous change protection is enabled for this repository.\nEdit the repository configuration before making dangerous changes.\" thrown in phacility/phabricator.","triggerScenarios":"Thrown at src/applications/diffusion/engine/DiffusionCommitHookEngine.php:295 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}