phacility/phabricator · error · Exception

Invalid mode " ".

Error message

Invalid mode "%s".

What it means

Enum guard in DiffusionUpdateCoverageConduitAPIMethod::execute: the 'mode' parameter of the coverage update did not match any of the switch cases ('' / 'overwrite' to replace all branch coverage, or 'update' to merge per-file coverage) and hit the default branch, which kills the open transaction before throwing. The supplied mode string is simply not one of the two supported coverage-write modes.

Solutions

  1. Pass mode as 'overwrite' (replace the branch's coverage) or 'update' (merge the provided files), or omit it entirely for the default overwrite behavior
  2. Check for typos or case differences in the mode value sent by the coverage tooling
  3. Upgrade the client tooling if it sends a mode value from a different API version
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/applications/diffusion/conduit/DiffusionUpdateCoverageConduitAPIMethod.php:103 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/b0abdbdb72ebd30e. Report an issue: GitHub.

Appendix: source

Thrown at src/applications/diffusion/conduit/DiffusionUpdateCoverageConduitAPIMethod.php:103

    $conn->openTransaction();
    $mode = $request->getValue('mode');
      switch ($mode) {
        case '':
        case 'overwrite':
          // sets the coverage for the whole branch, deleting all previous
          // coverage information
          queryfx(
            $conn,
            'DELETE FROM %T WHERE branchID = %d',
            $table_name,
            $branch->getID());
          break;
        case 'update':
          // sets the coverage for the provided files on the specified commit
          break;
        default:
          $conn->killTransaction();
          throw new Exception(pht('Invalid mode "%s".', $mode));
      }

      foreach (PhabricatorLiskDAO::chunkSQL($sql) as $chunk) {
        queryfx(
          $conn,
          'INSERT INTO %T (branchID, pathID, commitID, coverage) VALUES %LQ'.
          ' ON DUPLICATE KEY UPDATE coverage = VALUES(coverage)',
          $table_name,
          $chunk);
      }
    $conn->saveTransaction();
  }

}

View on GitHub (pinned to 5720a38cfe)