{"record":{"id":"f8b4b06ac9d715b5","repo":"phacility/phabricator","slug":"setting-s-is-misconfigured-s","errorCode":null,"errorMessage":"Setting \"%s\" is misconfigured: %s","messagePattern":"Setting \"(.+?)\" is misconfigured: (.+?)","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/search/management/PhabricatorSearchManagementWorkflow.php","lineNumber":18,"sourceCode":"<?php\n\nabstract class PhabricatorSearchManagementWorkflow\n  extends PhabricatorManagementWorkflow {\n\n  protected function validateClusterSearchConfig() {\n    // Configuration is normally validated by setup self-checks on the web\n    // workflow, but users may reasonably run `bin/search` commands after\n    // making manual edits to \"local.json\". Re-verify configuration here before\n    // continuing.\n\n    $config_key = 'cluster.search';\n    $config_value = PhabricatorEnv::getEnvConfig($config_key);\n\n    try {\n      PhabricatorClusterSearchConfigType::validateValue($config_value);\n    } catch (Exception $ex) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Setting \"%s\" is misconfigured: %s',\n          $config_key,\n          $ex->getMessage()));\n    }\n  }\n\n}\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/search/management/PhabricatorSearchManagementWorkflow.php#L1-L27","documentation":"Every `bin/search ...` subcommand calls validateClusterSearchConfig() before working. Web requests validate cluster.search through setup self-checks, but CLI runs after manual local.json edits do not, so this path re-runs PhabricatorClusterSearchConfigType::validateValue() and wraps any structural failure in this usage exception, chaining the specific underlying reason into the message.","triggerScenarios":"Hand-editing conf/local.json cluster.search with a malformed structure (wrong keys, missing hosts entries, bad port value, unknown engine type) and then running any bin/search command such as `bin/search index D1` or `bin/search status`.","commonSituations":"Switching from MySQL to Elasticsearch and mistyping the hosts array; forgetting the 'type' key or quotes around 'elasticsearch'; unbalanced JSON braces after manual edits; copy-pasting config from docs with placeholders left in.","solutions":["Read the tail of the message (%s) - it names the exact structural problem","Correct cluster.search to the documented shape: an array of engines each with 'type' and a 'hosts' list of {host, port, protocol} entries","Prefer bin/config edit cluster.search or the web config editor so JSON stays valid","Validate the file after hand edits (e.g. jq . conf/local.json) and re-run bin/search status as a smoke test"],"exampleFix":"// before (conf/local.json): missing protocol, malformed hosts\n\"cluster.search\": {\"type\": \"elasticsearch\", \"host\": \"127.0.0.1\", \"port\": 9200}\n\n// after: array of engines, hosts is a list\n\"cluster.search\": [{\"type\": \"elasticsearch\", \"hosts\": [{\"host\": \"127.0.0.1\", \"port\": 9200, \"protocol\": \"http\"}]}]","handlingStrategy":"validation","validationCode":"// Validate cluster.search the same way the CLI does, before shipping config\ntry {\n  PhabricatorClusterSearchConfigType::validateValue(\n    PhabricatorEnv::getEnvConfig('cluster.search'));\n} catch (Exception $ex) {\n  // block deploy: cluster.search is structurally invalid\n}","typeGuard":null,"tryCatchPattern":"try {\n  // run bin/search subcommand\n} catch (PhutilArgumentUsageException $ex) {\n  if (strpos($ex->getMessage(), 'cluster.search') !== false) {\n    // config problem, not usage: fix conf/local.json and retry\n  }\n}","preventionTips":["Edit cluster.search via bin/config or the web UI, not raw local.json","Run bin/search status as a post-edit smoke test","Lint JSON (jq .) after any manual config edit","Keep config in version control and diff before applying"],"tags":["config","cluster-search","bin-search","usage-error","json-config"],"backgroundTag":"config-validation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}