phacility/phabricator · error · DiffusionCommitHookRejectException

This push was rejected by custom hook script

Error message

This push was rejected by custom hook script '%s':

%s%s

What it means

Push rejection from applyCustomHooks: a repository-configured custom hook script exited nonzero. The message embeds the hook's name plus its combined stdout/stderr, and the failure aborts the push. This is Phabricator surfacing an external, user-defined pre-push check that failed.

Solutions

  1. Read the hook's own output in the message for its failure reason
  2. Fix the change to satisfy the custom hook's requirements
  3. Have the repository owner fix or relax the custom hook script if it is over-strict
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/diffusion/engine/DiffusionCommitHookEngine.php:690 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at src/applications/diffusion/engine/DiffusionCommitHookEngine.php:690

        // NOTE: We're explicitly running the hooks in sequential order to
        // make this more predictable.
        $future = id(new ExecFuture('%s %Ls', $hook, $args))
          ->setEnv($env, $wipe_process_env = false)
          ->write($stdin);

        list($err, $stdout, $stderr) = $future->resolve();
        if (!$err) {
          // This hook ran OK, but echo its output in case there was something
          // informative.
          $console->writeOut('%s', $stdout);
          $console->writeErr('%s', $stderr);
          continue;
        }

        $this->rejectCode = PhabricatorRepositoryPushLog::REJECT_EXTERNAL;
        $this->rejectDetails = basename($hook);

        throw new DiffusionCommitHookRejectException(
          pht(
            "This push was rejected by custom hook script '%s':\n\n%s%s",
            basename($hook),
            $stdout,
            $stderr));
      }
    }
  }

  private function getExecutablesInDirectory($directory) {
    $executables = array();

    if (!Filesystem::pathExists($directory)) {
      return $executables;
    }

    foreach (Filesystem::listDirectory($directory) as $path) {
      $full_path = $directory.DIRECTORY_SEPARATOR.$path;

View on GitHub (pinned to 5720a38cfe)