{"record":{"id":"c86406fc0139fd14","repo":"OpenNHP/opennhp","slug":"unknown-load-balance-scheme-q-valid-q-q-q","errorCode":null,"errorMessage":"unknown load-balance scheme %q (valid: %q, %q, %q)","messagePattern":"unknown load-balance scheme %q \\(valid: %q, %q, %q\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nhp/common/loadbalance/loadbalance.go","lineNumber":43,"sourceCode":"\tSchemeWeightedRandom Scheme = \"weighted-random\"\n\tSchemeRoundRobin     Scheme = \"round-robin\"\n)\n\n// DefaultScheme is what an empty / unset scheme normalises to.\n// Weighted-random matches the documented intuition \"spread requests\n// proportionally to declared instance weights\" without surprising\n// operators who left the field blank.\nconst DefaultScheme = SchemeWeightedRandom\n\n// Validate rejects unknown scheme strings at config-load time. An empty\n// string is accepted; callers should normalise it to DefaultScheme via\n// Normalize before constructing a Picker.\nfunc (s Scheme) Validate() error {\n\tswitch s {\n\tcase \"\", SchemeRandom, SchemeWeightedRandom, SchemeRoundRobin:\n\t\treturn nil\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown load-balance scheme %q (valid: %q, %q, %q)\",\n\t\t\tstring(s), SchemeRandom, SchemeWeightedRandom, SchemeRoundRobin)\n\t}\n}\n\n// Normalize returns the scheme with the empty string replaced by\n// DefaultScheme. Unknown schemes pass through unchanged — call\n// Validate first to reject them.\nfunc (s Scheme) Normalize() Scheme {\n\tif s == \"\" {\n\t\treturn DefaultScheme\n\t}\n\treturn s\n}\n\n// Weighted is the contract an instance type must satisfy to be Picked.\n// Implementations should return a non-negative integer; zero weight is\n// treated as 1 in NormalizeWeights so an instance with weight 0 in the\n// config still receives traffic.","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/nhp/common/loadbalance/loadbalance.go#L25-L61","documentation":"Raised by loadbalance.Scheme.Validate when the configured scheme string is non-empty but matches none of the registered schemes (random, weighted-random, round-robin). It is a config-load-time typo catcher: empty strings are accepted and later normalized to DefaultScheme, so this error specifically means a misspelled or unknown scheme value was supplied.","triggerScenarios":"Thrown at nhp/common/loadbalance/loadbalance.go:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Correct the scheme to one of the values enumerated in the error message","Leave the field empty/unset to accept the default (weighted-random)","Check for version skew if a scheme name valid in another release was used"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6e04ca5ff03222a699c24205cd4bf8fee9af7ffe","analyzedAt":"2026-09-07T15:44:59.941Z","contentChangedAt":"2026-09-07T15:44:59.941Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}