{"record":{"id":"d69f127b5f6e0202","repo":"ruvnet/ruflo","slug":"router-failed-to-load-models-for-candidate-looku","errorCode":null,"errorMessage":"[router] failed to load models for candidate lookup","messagePattern":"\\[router\\] failed to load models for candidate lookup","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ruflo/src/ruvocal/src/lib/server/router/endpoint.ts","lineNumber":142,"sourceCode":"\t\t\t(config.LLM_ROUTER_ENABLE_MULTIMODAL || \"\").toLowerCase() === \"true\";\n\t\tconst routerToolsEnabled = isRouterToolsBypassEnabled();\n\t\tconst hasImageInput = sanitizedMessages.some((message) =>\n\t\t\t(message.files ?? []).some(\n\t\t\t\t(file) => typeof file?.mime === \"string\" && file.mime.startsWith(\"image/\")\n\t\t\t)\n\t\t);\n\t\t// Tools are considered \"active\" if the client indicated any enabled MCP server\n\t\tconst hasToolsActive = hasActiveToolsSelection(params.locals);\n\n\t\t// Helper to create an OpenAI endpoint for a specific candidate model id\n\t\tasync function createCandidateEndpoint(candidateModelId: string): Promise<Endpoint> {\n\t\t\t// Try to use the real candidate model config if present in chat-ui's model list\n\t\t\tlet modelForCall: ProcessedModel | undefined;\n\t\t\ttry {\n\t\t\t\tconst all = await getModels();\n\t\t\t\tmodelForCall = all?.find((m) => m.id === candidateModelId || m.name === candidateModelId);\n\t\t\t} catch (e) {\n\t\t\t\tlogger.warn({ err: String(e) }, \"[router] failed to load models for candidate lookup\");\n\t\t\t}\n\n\t\t\tif (!modelForCall) {\n\t\t\t\t// Fallback: clone router model with candidate id\n\t\t\t\tmodelForCall = {\n\t\t\t\t\t...routerModel,\n\t\t\t\t\tid: candidateModelId,\n\t\t\t\t\tname: candidateModelId,\n\t\t\t\t\tdisplayName: candidateModelId,\n\t\t\t\t} as ProcessedModel;\n\t\t\t}\n\n\t\t\treturn endpoints.openai({\n\t\t\t\ttype: \"openai\",\n\t\t\t\tbaseURL: (config.OPENAI_BASE_URL || \"https://router.huggingface.co/v1\").replace(/\\/$/, \"\"),\n\t\t\t\tapiKey: getApiToken(params.locals),\n\t\t\t\tmodel: modelForCall,\n\t\t\t\t// Ensure streaming path is used","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/ruflo/src/ruvocal/src/lib/server/router/endpoint.ts#L124-L160","documentation":"Log warning in createCandidateEndpoint: fetching the model list to resolve a candidate model id for router fallback failed, so candidate-based aliasing cannot proceed and the caller must use the default model path.","triggerScenarios":"Thrown at ruflo/src/ruvocal/src/lib/server/router/endpoint.ts:142 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the router's upstream model catalog is reachable and loaded; retry after the model list loads successfully.","Inspect router logs for the underlying selection error and fix the failing candidate/endpoint."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}