{"record":{"id":"e8dc10443620126c","repo":"XTLS/Xray-core","slug":"unrecognized-balancer-type","errorCode":null,"errorMessage":"unrecognized balancer type","messagePattern":"unrecognized balancer type","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/router/config.go","lineNumber":167,"sourceCode":"\t\t}\n\t\tleastLoadStrategy := NewLeastLoadStrategy(s)\n\t\treturn &Balancer{\n\t\t\tselectors:   br.OutboundSelector,\n\t\t\tohm:         ohm,\n\t\t\tfallbackTag: br.FallbackTag,\n\t\t\tstrategy:    leastLoadStrategy,\n\t\t}, nil\n\tcase \"random\":\n\t\tfallthrough\n\tcase \"\":\n\t\treturn &Balancer{\n\t\t\tselectors:   br.OutboundSelector,\n\t\t\tohm:         ohm,\n\t\t\tfallbackTag: br.FallbackTag,\n\t\t\tstrategy:    &RandomStrategy{FallbackTag: br.FallbackTag},\n\t\t}, nil\n\tdefault:\n\t\treturn nil, errors.New(\"unrecognized balancer type\")\n\t}\n}\n","sourceCodeStart":149,"sourceCodeEnd":170,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/app/router/config.go#L149-L170","documentation":"BalancingRule.Build switches on the lowercased strategy name and only accepts leastping, leastload, random, and empty string. Any other value falls to default and fails balancer construction, which in turn fails router startup or ReloadRules.","triggerScenarios":"Setting strategy.type to an unknown string (e.g. 'roundrobin' spelled out, 'leastPing' with odd casing is fine due to ToLower, but 'minping' or a typo like 'leastLoad ' with trailing space in some paths) — any value outside the accepted set.","commonSituations":"Typos in hand-written configs; strategies renamed or removed across versions; copying configs from other projects with custom strategy extensions.","solutions":["Use one of: leastping, leastload, random, or omit strategy for the default random behavior","Check for stray whitespace/case in the strategy value","Consult the current config docs for the supported strategy list of your version"],"exampleFix":"// before\n\"strategy\": { \"type\": \"round-robin\" }\n\n// after\n\"strategy\": { \"type\": \"random\" }","handlingStrategy":"validation","validationCode":"var validStrategies = map[string]bool{\"leastping\": true, \"leastload\": true, \"random\": true, \"\": true}\nif !validStrategies[strings.ToLower(strings.TrimSpace(strategy))] {\n    return fmt.Errorf(\"unsupported strategy %q; use leastping|leastload|random\", strategy)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Offer strategy choices from a fixed enum in any config UI","Trim whitespace and lowercase before validating user input","Re-check supported strategies when upgrading xray-core"],"tags":["routing","balancer","configuration","strategy"],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}