phacility/phabricator · error · Exception

Expected "multipart/form-data" content type when executing a

Error message

Expected "multipart/form-data" content type when executing a multipart body read.

What it means

Thrown by 'bin/repository thaw --promote' when devices with active bindings still hold working copy versions, i.e. the cluster already has one or more unambiguous leaders. Promotion is the tool for resolving ambiguous or lost leadership; promoting on top of an existing healthy leader would discard that leader's data, so thaw refuses and names the current leader devices.

Source

Thrown at src/aphront/multipartparser/AphrontMultipartParser.php:31

  private $parts;

  public function setContentType($content_type) {
    $this->contentType = $content_type;
    return $this;
  }

  public function getContentType() {
    return $this->contentType;
  }

  public function beginParse() {
    $content_type = $this->getContentType();
    if ($content_type === null) {
      throw new PhutilInvalidStateException('setContentType');
    }

    if (!preg_match('(^multipart/form-data)', $content_type)) {
      throw new Exception(
        pht(
          'Expected "multipart/form-data" content type when executing a '.
          'multipart body read.'));
    }

    $type_parts = preg_split('(\s*;\s*)', $content_type);
    $boundary = null;
    foreach ($type_parts as $type_part) {
      $matches = null;
      if (preg_match('(^boundary=(.*))', $type_part, $matches)) {
        $boundary = $matches[1];
        break;
      }
    }

    if ($boundary === null) {
      throw new Exception(
        pht('Received "multipart/form-data" request with no "boundary".'));

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Demote the existing leader device(s) named in the message first ('bin/repository thaw --demote <leader> R12'), then promote the intended device.
  2. Re-check cluster status (versions, locks) to confirm promotion is actually needed; if the leader is healthy, no thaw is required.
  3. If the message lists exactly the device you intended to promote, its version already makes it the leader and no action is needed.

Example fix

# before
bin/repository thaw --promote repo-007 R12

# afterin/repository thaw --demote repo-003 R12 --force
bin/repository thaw --promote repo-007 R12 --force
Defensive patterns

Strategy: validation

Validate before calling

// Ensure no active device still holds a version before promoting:
$active = array_select_keys($versions, array_keys($bindings));
if ($active) { /* demote existing leaders first, or skip promote entirely */ }

Prevention

When it happens

Trigger: Running 'bin/repository thaw --promote repo-007 R12' while repo-007's version rows exist and active devices also have version rows: $active = array_select_keys($versions, array_keys($bindings)) is non-empty, so the guard at PhabricatorRepositoryManagementThawWorkflow.php:271 throws with the active devices' handle names.

Common situations: Operators promoting a replica 'to be safe' when the cluster is not actually stuck; misdiagnosing a stuck write lock (which needs --demote) as a leadership problem; recovery attempts that skip demoting the current leader first.

Related errors


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