{"record":{"id":"ac95e542a26bd1ef","repo":"phacility/phabricator","slug":"expected-multipart-form-data-content-type-when-e","errorCode":null,"errorMessage":"Expected \"multipart/form-data\" content type when executing a multipart body read.","messagePattern":"Expected \"multipart/form-data\" content type when executing a multipart body read\\.","errorType":"validation","errorClass":"Exception","httpStatus":500,"severity":"error","filePath":"src/aphront/multipartparser/AphrontMultipartParser.php","lineNumber":31,"sourceCode":"  private $parts;\n\n  public function setContentType($content_type) {\n    $this->contentType = $content_type;\n    return $this;\n  }\n\n  public function getContentType() {\n    return $this->contentType;\n  }\n\n  public function beginParse() {\n    $content_type = $this->getContentType();\n    if ($content_type === null) {\n      throw new PhutilInvalidStateException('setContentType');\n    }\n\n    if (!preg_match('(^multipart/form-data)', $content_type)) {\n      throw new Exception(\n        pht(\n          'Expected \"multipart/form-data\" content type when executing a '.\n          'multipart body read.'));\n    }\n\n    $type_parts = preg_split('(\\s*;\\s*)', $content_type);\n    $boundary = null;\n    foreach ($type_parts as $type_part) {\n      $matches = null;\n      if (preg_match('(^boundary=(.*))', $type_part, $matches)) {\n        $boundary = $matches[1];\n        break;\n      }\n    }\n\n    if ($boundary === null) {\n      throw new Exception(\n        pht('Received \"multipart/form-data\" request with no \"boundary\".'));","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/aphront/multipartparser/AphrontMultipartParser.php#L13-L49","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Demote the existing leader device(s) named in the message first ('bin/repository thaw --demote <leader> R12'), then promote the intended device.","Re-check cluster status (versions, locks) to confirm promotion is actually needed; if the leader is healthy, no thaw is required.","If the message lists exactly the device you intended to promote, its version already makes it the leader and no action is needed."],"exampleFix":"# before\nbin/repository thaw --promote repo-007 R12\n\n# after\bin/repository thaw --demote repo-003 R12 --force\nbin/repository thaw --promote repo-007 R12 --force","handlingStrategy":"validation","validationCode":"// Ensure no active device still holds a version before promoting:\n$active = array_select_keys($versions, array_keys($bindings));\nif ($active) { /* demote existing leaders first, or skip promote entirely */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Promote only after the cluster has zero leaders (demote first) or when leadership is genuinely ambiguous.","For stuck write locks prefer --demote on the affected device rather than promoting a replica."],"tags":["phabricator","cli","cluster-repositories","promote-demote","leader-election"],"backgroundTag":"cluster-leader-conflict","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}