{"record":{"id":"f72417ae67550418","repo":"livekit/livekit","slug":"unknown-node-selector-algorithm-option","errorCode":null,"errorMessage":"unknown node selector algorithm option","messagePattern":"unknown node selector algorithm option","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/routing/selector/errors.go","lineNumber":26,"sourceCode":"//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage selector\n\nimport \"errors\"\n\nvar (\n\tErrNoAvailableNodes           = errors.New(\"could not find any available nodes\")\n\tErrCurrentRegionNotSet        = errors.New(\"current region cannot be blank\")\n\tErrCurrentRegionUnknownLatLon = errors.New(\"unknown lat and lon for the current region\")\n\tErrSortByNotSet               = errors.New(\"sort by option cannot be blank\")\n\tErrAlgorithmNotSet            = errors.New(\"node selector algorithm option cannot be blank\")\n\tErrSortByUnknown              = errors.New(\"unknown sort by option\")\n\tErrAlgorithmUnknown           = errors.New(\"unknown node selector algorithm option\")\n)\n","sourceCodeStart":8,"sourceCodeEnd":28,"githubUrl":"https://github.com/livekit/livekit/blob/ee45c3f0b1a83bf4352dbccb6607ebf70b2a5de6/pkg/routing/selector/errors.go#L8-L28","documentation":"ErrAlgorithmUnknown is returned by SelectSortedNode when the Algorithm value matches no known algorithm branch (oneof, twochoice, etc.). Unlike ErrAlgorithmNotSet (empty), this means a non-empty but unrecognized algorithm was supplied.","triggerScenarios":"Calling SelectNode with a selector whose Algorithm is set to a string not handled in the switch at pkg/routing/selector/utils.go:93, such as \"leastloaded\" or a misspelled \"two-chice\".","commonSituations":"Typos in node_selector.algorithm config; documenting/inventing algorithm names not implemented in the deployed LiveKit version; version drift where an algorithm was renamed or removed.","solutions":["Verify the algorithm name against the supported set in pkg/routing/selector/utils.go and correct the config.","Pin the LiveKit version and check its changelog for algorithm renames.","Validate the algorithm at config load time so it fails at startup rather than per-request."],"exampleFix":"// before\nalgorithm: \"least-loaded\"\n// after\nalgorithm: \"twochoice\"","handlingStrategy":"validation","validationCode":"var validAlgorithms = map[string]bool{\"oneof\": true, \"twochoice\": true}\nif sel.Algorithm != \"\" && !validAlgorithms[sel.Algorithm] {\n  return fmt.Errorf(\"unsupported node_selector.algorithm: %q\", sel.Algorithm)\n}","typeGuard":null,"tryCatchPattern":"node, err := sel.SelectNode(nodes)\nif errors.Is(err, selector.ErrAlgorithmUnknown) {\n  logger.Errorw(\"invalid node selector algorithm\", \"algorithm\", sel.Algorithm)\n}","preventionTips":["Pin your livekit-server version and match config to its supported algorithm names.","Validate the algorithm at config-load time so failures happen at boot.","Add a startup smoke test that runs SelectNode with production config."],"tags":["go","config","node-selector","livekit"],"backgroundTag":"invalid-config-value","analyzedSha":"ee45c3f0b1a83bf4352dbccb6607ebf70b2a5de6","analyzedAt":"2026-09-02T03:56:08.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}