{"record":{"id":"aa8e03497a6d74c6","repo":"phacility/phabricator","slug":"multiple-masters-databases-s-and-s-specify","errorCode":null,"errorMessage":"Multiple masters (databases \"%s\" and \"%s\") specify that they are the \"default\" partition. Only one master may be the default.","messagePattern":"Multiple masters \\(databases \"(.+?)\" and \"(.+?)\"\\) specify that they are the \"default\" partition\\. Only one master may be the default\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"src/infrastructure/cluster/PhabricatorDatabaseRefParser.php","lineNumber":103,"sourceCode":"          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()));\n            } else {\n              $default_ref = $ref;\n              $ref->setIsDefaultPartition(true);\n            }\n          } else if (isset($partition_map[$application])) {\n            throw new Exception(\n              pht(\n                'Multiple masters (databases \"%s\" and \"%s\") specify that '.\n                'they are the partition for application \"%s\". Each '.\n                'application may be allocated to only one partition.',\n                $partition_map[$application]->getRefKey(),\n                $ref->getRefKey(),","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/cluster/PhabricatorDatabaseRefParser.php#L85-L121","documentation":"In a partitioned multi-master cluster, the 'default' partition (the master serving any application not explicitly allocated) may be claimed by exactly one master. The parser throws this exception when a second master's partition list also contains 'default'.","triggerScenarios":"Two cluster.databases master entries both list 'default' in their 'partition' arrays; the parser hits the second claim while $default_ref is already set.","commonSituations":"Copy-pasting the first master's partition block to the second; splitting applications between masters and leaving 'default' on both sides 'to be safe'; merging config branches where each added its own default.","solutions":["Remove 'default' from all but one master's 'partition' list.","Give the other master only concrete application names (e.g. 'maniphest', 'diffusion').","Re-validate the whole cluster.databases config after the edit (bin/config get + reload)."],"exampleFix":"// before\n[\"partition\" => [\"default\", \"maniphest\"]]  // db1\n[\"partition\" => [\"default\", \"differential\"]] // db2\n\n// after\n[\"partition\" => [\"default\", \"maniphest\"]]  // db1\n[\"partition\" => [\"differential\"]]           // db2","handlingStrategy":"validation","validationCode":"// Exactly one master may claim 'default'\n$defaults = 0;\nforeach ($cluster_database_config as $server) {\n  if (!empty($server['master'])\n      && in_array('default', idx($server, 'partition', array()), true)) {\n    $defaults++;\n  }\n}\nif ($defaults > 1) {\n  // reject the config before deploy\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat 'default' as a singleton: assign it once, explicitly, in the primary master block.","Review partition lists after any master addition or removal.","Automate the uniqueness check in config CI."],"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"}