{"record":{"id":"4e23671f1ac2af7b","repo":"phacility/phabricator","slug":"this-server-is-configured-with-multiple-master-dat","errorCode":null,"errorMessage":"This server is configured with multiple master databases, but master \"%s\" is missing a \"partition\" configuration key to define application partitioning.","messagePattern":"This server is configured with multiple master databases, but master \"(.+?)\" is missing a \"partition\" configuration key to define application partitioning\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"src/infrastructure/cluster/PhabricatorDatabaseRefParser.php","lineNumber":91,"sourceCode":"        $master_count++;\n      }\n\n      $refs[$key] = $ref;\n    }\n\n    $is_partitioned = ($master_count > 1);\n    if ($is_partitioned) {\n      $default_ref = null;\n      $partition_map = array();\n      foreach ($refs as $key => $ref) {\n        if (!$ref->getIsMaster()) {\n          continue;\n        }\n\n        $server = $config[$key];\n        $partition = idx($server, 'partition');\n        if (!is_array($partition)) {\n          throw new Exception(\n            pht(\n              'This server is configured with multiple master databases, '.\n              'but master \"%s\" is missing a \"partition\" configuration key to '.\n              'define application partitioning.',\n              $ref->getRefKey()));\n        }\n\n        $application_map = array();\n        foreach ($partition as $application) {\n          if ($application === 'default') {\n            if ($default_ref) {\n              throw new Exception(\n                pht(\n                  'Multiple masters (databases \"%s\" and \"%s\") specify that '.\n                  'they are the \"default\" partition. Only one master may be '.\n                  'the default.',\n                  $ref->getRefKey(),\n                  $default_ref->getRefKey()));","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/cluster/PhabricatorDatabaseRefParser.php#L73-L109","documentation":"When cluster.databases defines more than one master, Phabricator partitions applications across them. Each master must carry a 'partition' key listing the application databases (or 'default') it owns; a master missing that array key fails config parsing with this exception.","triggerScenarios":"Adding a second master entry to cluster.databases without adding a 'partition' list to the existing one, so $master_count > 1 while some master's config has no 'partition' array. Parsing happens when the database ref list is built (early in any request).","commonSituations":"Scaling out from a single database by pasting a second master block while forgetting the original also needs a partition map; following outdated cluster documentation that predates partitioning; YAML/JSON indentation making 'partition' a sibling of the wrong node.","solutions":["Add a 'partition' array to every master in cluster.databases, e.g. array('partition' => array('default')) or array('partition' => array('maniphest', 'differential')).","Ensure exactly one master claims 'default' and applications are allocated to only one master each.","Re-check with 'bin/config get cluster.databases' after editing, then reload the page.","If you do not actually need multiple masters, go back to a single master entry (partitioning is then not required)."],"exampleFix":"// before\n[\n  [\"master\" => true, \"host\" => \"db1\", \"port\" => 3306],\n  [\"master\" => true, \"host\" => \"db2\", \"port\" => 3306]\n]\n\n// after\n[\n  [\"master\" => true, \"host\" => \"db1\", \"port\" => 3306,\n   \"partition\" => [\"default\"]],\n  [\"master\" => true, \"host\" => \"db2\", \"port\" => 3306,\n   \"partition\" => [\"maniphest\", \"differential\"]]\n]","handlingStrategy":"validation","validationCode":"// Lint cluster.databases before it reaches production\ntry {\n  $refs = id(new PhabricatorDatabaseRefParser())\n    ->newRefs($cluster_database_config);\n} catch (Exception $ex) {\n  // block the deploy: $ex->getMessage() names the offending master\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whenever master_count > 1, write a 'partition' list for every master in the same edit.","Keep a JSON schema check for cluster.databases in the deploy pipeline.","Test multi-master changes on a staging host before applying to production."],"tags":["phabricator","database","cluster","config-validation","partitioning"],"backgroundTag":"invalid-database-config","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}