{"record":{"id":"1f0198ecb98a1715","repo":"Mintplex-Labs/anything-llm","slug":"router-not-found","errorCode":null,"errorMessage":"Router not found.","messagePattern":"Router not found\\.","errorType":"http","errorClass":null,"httpStatus":404,"severity":"error","filePath":"server/endpoints/modelRouter.js","lineNumber":40,"sourceCode":"      } catch (e) {\n        console.error(e);\n        response.sendStatus(500);\n      }\n    }\n  );\n\n  app.get(\n    \"/model-routers/:id\",\n    [validatedRequest, flexUserRoleValid([ROLES.admin])],\n    async (request, response) => {\n      try {\n        const { id } = request.params;\n        const router = await ModelRouter.getWithRulesAndCount({\n          id: Number(id),\n        });\n        if (!router) {\n          response\n            .status(404)\n            .json({ router: null, error: \"Router not found.\" });\n          return;\n        }\n        response.status(200).json({ router });\n      } catch (e) {\n        console.error(e);\n        response.sendStatus(500);\n      }\n    }\n  );\n\n  app.post(\n    \"/model-routers/new\",\n    [validatedRequest, flexUserRoleValid([ROLES.admin])],\n    async (request, response) => {\n      try {\n        const user = await userFromSession(request, response);\n        const data = reqBody(request);","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/modelRouter.js#L22-L58","documentation":"Lookup miss in the GET /model-routers/:id admin endpoint: ModelRouter.getWithRulesAndCount returned null for the numeric id, meaning no model router row exists with that id, so a 404 with a null router is returned.","triggerScenarios":"Thrown at server/endpoints/modelRouter.js:40 when the library encounters an invalid state.","commonSituations":"Referencing a model router that has not been created or was deleted.","solutions":["Verify the router ID or name exists before referencing it.","List configured routers and use a valid identifier."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}