{"record":{"id":"e4847583f40e370e","repo":"phacility/phabricator","slug":"multiple-masters-databases-s-and-s-specify-e48475","errorCode":null,"errorMessage":"Multiple masters (databases \"%s\" and \"%s\") specify that they are the partition for application \"%s\". Each application may be allocated to only one partition.","messagePattern":"Multiple masters \\(databases \"(.+?)\" and \"(.+?)\"\\) specify that they are the partition for application \"(.+?)\"\\. Each application may be allocated to only one partition\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"critical","filePath":"src/infrastructure/cluster/PhabricatorDatabaseRefParser.php","lineNumber":115,"sourceCode":"        }\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(),\n                $application));\n          } else {\n            // TODO: We should check that the application is valid, to\n            // prevent typos in application names. However, we do not\n            // currently have an efficient way to enumerate all of the valid\n            // application database names.\n\n            $partition_map[$application] = $ref;\n            $application_map[$application] = $application;\n          }\n        }\n","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/cluster/PhabricatorDatabaseRefParser.php#L97-L133","documentation":"Each application database may be allocated to exactly one partition in a multi-master cluster. The parser tracks applications in $partition_map and throws when a second master's 'partition' list names an application that another master already owns.","triggerScenarios":"Two cluster.databases masters both include the same application name (e.g. 'maniphest') in their 'partition' arrays.","commonSituations":"Overlapping partition lists after splitting by team; a renamed copy of a master block that still carries the old application list; intending a master/replica setup but configuring two masters with identical partitions instead.","solutions":["Assign each application name to exactly one master's 'partition' list and delete duplicates.","If you wanted replication rather than partitioning, keep one master and configure the second host as a replica ('master' => false).","Re-check that every application still lands somewhere (or on 'default') after the edit."],"exampleFix":"// before\n[\"partition\" => [\"maniphest\", \"differential\"]] // db1\n[\"partition\" => [\"differential\"]]                // db2\n\n// after\n[\"partition\" => [\"maniphest\"]] // db1\n[\"partition\" => [\"differential\"]] // db2","handlingStrategy":"validation","validationCode":"// Each application may appear in only one partition list\n$seen = array();\nforeach ($cluster_database_config as $server) {\n  foreach (idx($server, 'partition', array()) as $application) {\n    if ($application === 'default') { continue; }\n    if (isset($seen[$application])) {\n      // reject: application allocated to two masters\n    }\n    $seen[$application] = true;\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep partition allocation in one authoritative table (master -> app list) and generate config from it.","After splitting applications, grep all masters' partition lists for the moved names.","Use a replica (not a second master) when the goal is redundancy, not partitioning."],"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"}