phacility/phabricator · warning · Exception

Write rate must be more than 0 bytes/sec.

Error message

Write rate must be more than 0 bytes/sec.

What it means

Thrown by 'bin/harbormaster write-log' after stdin has been read, when --rate is given with a value of 0 or less. The rate artificially paces log writes (str_split into rate-sized chunks) to exercise live streaming; a non-positive rate cannot pace anything, so a plain Exception aborts the command.

Source

Thrown at src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php:68

    $log = HarbormasterBuildLog::initializeNewBuildLog($target);
    $log->openBuildLog();

    echo tsprintf(
      "%s\n\n        __%s__\n\n",
      pht('Opened a new build log:'),
      PhabricatorEnv::getURI($log->getURI()));

    echo tsprintf(
      "%s\n",
      pht('Reading log content from stdin...'));

    $content = file_get_contents('php://stdin');

    $rate = $args->getArg('rate');
    if ($rate) {
      if ($rate <= 0) {
        throw new Exception(
          pht(
            'Write rate must be more than 0 bytes/sec.'));
      }

      echo tsprintf(
        "%s\n",
        pht('Writing log, slowly...'));

      $offset = 0;
      $total = strlen($content);
      $pieces = str_split($content, $rate);

      $bar = id(new PhutilConsoleProgressBar())
        ->setTotal($total);

      foreach ($pieces as $piece) {
        $log->append($piece);
        $bar->update(strlen($piece));

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Use a positive integer rate in bytes/sec, e.g. '--rate 1024'
  2. Omit --rate entirely to write at full speed
  3. Validate computed rate values in scripts before passing them through

Example fix

# before
$ bin/harbormaster write-log --target 33 --rate 0
# after
$ bin/harbormaster write-log --target 33 --rate 1024
Defensive patterns

Strategy: validation

Validate before calling

if ($rate !== null && $rate <= 0) {
  // reject before invoking write-log; omit --rate for unlimited speed
}

Prevention

When it happens

Trigger: Running 'bin/harbormaster write-log --target 33 --rate 0' or with any negative rate; a script computing the rate from a division that yields 0.

Common situations: Passing --rate 0 or -1 intending 'no limit' (the flag should simply be omitted); computed rate values that underflow to zero in wrapper scripts.

Related errors


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