{"record":{"id":"cb03a3323b0e4fc7","repo":"ruvnet/ruflo","slug":"router-candidate-failed","errorCode":null,"errorMessage":"[router] candidate failed","messagePattern":"\\[router\\] candidate failed","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ruflo/src/ruvocal/src/lib/server/router/endpoint.ts","lineNumber":298,"sourceCode":"\t\t}\n\n\t\tconst fallbackModel = config.LLM_ROUTER_FALLBACK_MODEL || routerModel.id;\n\t\tconst { candidates } = resolveRouteModels(routeSelection.routeName, routes, fallbackModel);\n\n\t\tlet lastErr: unknown = undefined;\n\t\tfor (const candidate of candidates) {\n\t\t\ttry {\n\t\t\t\tlogger.info(\n\t\t\t\t\t{ route: routeSelection.routeName, model: candidate },\n\t\t\t\t\t\"[router] trying candidate\"\n\t\t\t\t);\n\t\t\t\tconst ep = await createCandidateEndpoint(candidate);\n\t\t\t\tconst gen = await ep({ ...params });\n\t\t\t\treturn metadataThenStream(gen, candidate, routeSelection.routeName);\n\t\t\t} catch (e) {\n\t\t\t\tlastErr = e;\n\t\t\t\tconst { message: errMsg, statusCode: errStatus } = extractUpstreamError(e);\n\t\t\t\tlogger.warn(\n\t\t\t\t\t{\n\t\t\t\t\t\troute: routeSelection.routeName,\n\t\t\t\t\t\tmodel: candidate,\n\t\t\t\t\t\terr: errMsg,\n\t\t\t\t\t\t...(errStatus && { status: errStatus }),\n\t\t\t\t\t},\n\t\t\t\t\t\"[router] candidate failed\"\n\t\t\t\t);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\t// Exhausted all candidates — throw to signal upstream failure\n\t\t// Forward the upstream error to the client\n\t\tconst { message, statusCode } = extractUpstreamError(lastErr);\n\t\tthrow statusCode ? new HTTPError(message, statusCode) : new Error(message);\n\t};\n}","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/ruflo/src/ruvocal/src/lib/server/router/endpoint.ts#L280-L316","documentation":"Log warning in makeRouterEndpoint's candidate loop: the current candidate model threw during endpoint creation or generation; the error is recorded as lastErr and the loop proceeds to the next candidate in the resolved route list.","triggerScenarios":"Thrown at ruflo/src/ruvocal/src/lib/server/router/endpoint.ts:298 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the candidate endpoint's error details in the log context; fix the failing candidate (auth, model name, or availability) or remove it from the candidate list."],"exampleFix":null,"handlingStrategy":"retry","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"}