{"record":{"id":"5f5c326fdde2f42c","repo":"phacility/phabricator","slug":"write-rate-must-be-more-than-0-bytes-sec","errorCode":null,"errorMessage":"Write rate must be more than 0 bytes/sec.","messagePattern":"Write rate must be more than 0 bytes/sec\\.","errorType":"console","errorClass":"Exception","httpStatus":null,"severity":"warning","filePath":"src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php","lineNumber":68,"sourceCode":"\n    $log = HarbormasterBuildLog::initializeNewBuildLog($target);\n    $log->openBuildLog();\n\n    echo tsprintf(\n      \"%s\\n\\n        __%s__\\n\\n\",\n      pht('Opened a new build log:'),\n      PhabricatorEnv::getURI($log->getURI()));\n\n    echo tsprintf(\n      \"%s\\n\",\n      pht('Reading log content from stdin...'));\n\n    $content = file_get_contents('php://stdin');\n\n    $rate = $args->getArg('rate');\n    if ($rate) {\n      if ($rate <= 0) {\n        throw new Exception(\n          pht(\n            'Write rate must be more than 0 bytes/sec.'));\n      }\n\n      echo tsprintf(\n        \"%s\\n\",\n        pht('Writing log, slowly...'));\n\n      $offset = 0;\n      $total = strlen($content);\n      $pieces = str_split($content, $rate);\n\n      $bar = id(new PhutilConsoleProgressBar())\n        ->setTotal($total);\n\n      foreach ($pieces as $piece) {\n        $log->append($piece);\n        $bar->update(strlen($piece));","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/harbormaster/management/HarbormasterManagementWriteLogWorkflow.php#L50-L86","documentation":"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.","triggerScenarios":"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.","commonSituations":"Passing --rate 0 or -1 intending 'no limit' (the flag should simply be omitted); computed rate values that underflow to zero in wrapper scripts.","solutions":["Use a positive integer rate in bytes/sec, e.g. '--rate 1024'","Omit --rate entirely to write at full speed","Validate computed rate values in scripts before passing them through"],"exampleFix":"# before\n$ bin/harbormaster write-log --target 33 --rate 0\n# after\n$ bin/harbormaster write-log --target 33 --rate 1024","handlingStrategy":"validation","validationCode":"if ($rate !== null && $rate <= 0) {\n  // reject before invoking write-log; omit --rate for unlimited speed\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit --rate instead of passing 0 or -1 when you want full-speed writes","Sanitize computed rate values in wrapper scripts (positive integers only)"],"tags":["harbormaster","phabricator","cli","invalid-value","build-log"],"backgroundTag":"invalid-option-value","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}