{"record":{"id":"9938fd80be5a7b2f","repo":"phacility/phabricator","slug":"search-cluster-configuration-has-an-invalid-host-s","errorCode":null,"errorMessage":"Search cluster configuration has an invalid host specification (at index \"%s\"): %s.","messagePattern":"Search cluster configuration has an invalid host specification \\(at index \"(.+?)\"\\): (.+?)\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/infrastructure/cluster/config/PhabricatorClusterSearchConfigType.php","lineNumber":70,"sourceCode":"            $spec['type'],\n            implode(', ', array_keys($engines))));\n      }\n\n      if (isset($spec['hosts'])) {\n        foreach ($spec['hosts'] as $hostindex => $host) {\n          try {\n            PhutilTypeSpec::checkMap(\n              $host,\n              array(\n                'host'     => 'string',\n                'roles'     => 'optional map<string, wild>',\n                'port'      => 'optional int',\n                'protocol'  => 'optional string',\n                'path'      => 'optional string',\n                'version'   => 'optional int',\n              ));\n          } catch (Exception $ex) {\n            throw new Exception(\n              pht(\n                'Search cluster configuration has an invalid host '.\n                'specification (at index \"%s\"): %s.',\n                $hostindex,\n                $ex->getMessage()));\n          }\n        }\n      }\n    }\n  }\n}\n","sourceCodeStart":52,"sourceCodeEnd":82,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/cluster/config/PhabricatorClusterSearchConfigType.php#L52-L82","documentation":"Each entry in a service's `hosts` list is checked with PhutilTypeSpec::checkMap and must be a map with a required `host` string plus optional roles (map), port (int), protocol (string), path (string), version (int). Unknown keys, a missing `host` key, or wrong value types raise this error, tagged with the index of the failing host inside `hosts` and the underlying check detail.","triggerScenarios":"A host entry like `array('es1.example.com')` (bare string), `array('hosts' => 'es1.example.com')` (wrong nesting), omitting the required `host` key, or adding unsupported keys like `user` or `scheme`. Also `port` passed as a quoted string.","commonSituations":"Pasting hostnames as strings instead of dictionaries; confusing the service-level and host-level schemas; converting a URL like `http://es1:9200/idx` into fields incorrectly.","solutions":["Wrap each host as `array('host' => 'es1.example.com', 'port' => 9200)`.","Keep only host/roles/port/protocol/path/version keys in host entries; delete anything else.","Ensure `port` and `version` are unquoted integers and every host map has a `host` string."],"exampleFix":"// before\n'hosts' => array('es1.example.com', 'es2.example.com'),\n// after\n'hosts' => array(\n  array('host' => 'es1.example.com', 'port' => 9200),\n  array('host' => 'es2.example.com', 'port' => 9200),\n),","handlingStrategy":"validation","validationCode":"$host_schema = array(\n  'host'     => 'string',\n  'roles'    => 'optional map<string, wild>',\n  'port'     => 'optional int',\n  'protocol' => 'optional string',\n  'path'     => 'optional string',\n  'version'  => 'optional int',\n);\nforeach ($spec['hosts'] as $host) {\n  PhutilTypeSpec::checkMap($host, $host_schema);\n}","typeGuard":"function isSearchHostSpec($host) {\n  return is_array($host)\n    && isset($host['host']) && is_string($host['host'])\n    && (!isset($host['port']) || is_int($host['port']));\n}","tryCatchPattern":null,"preventionTips":["Always wrap hostnames: `array('host' => 'es1', 'port' => 9200)`, never a bare string.","Only the six host keys are allowed — put cluster-wide options at the service level, not on hosts.","Use the UI's Add Host flow once and copy its output as the canonical template."],"tags":["php","phabricator","config","search","validation","schema"],"backgroundTag":"search-cluster-config-invalid","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}