{"record":{"id":"b26f8fd8117d1b0d","repo":"Mintplex-Labs/anything-llm","slug":"a-router-with-that-name-already-exists","errorCode":null,"errorMessage":"A router with that name already exists.","messagePattern":"A router with that name already exists\\.","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/endpoints/modelRouter.js","lineNumber":64,"sourceCode":"        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);\n        const { router, error } = await ModelRouter.create(\n          data,\n          user?.id || null\n        );\n\n        if (error) return response.status(400).json({ router, error });\n        await Telemetry.sendTelemetry(\"model_router_created\");\n        return response.status(200).json({ router });\n      } catch (e) {\n        console.error(e);\n        response.sendStatus(500);\n      }\n    }\n  );\n\n  app.put(\n    \"/model-routers/:id\",\n    [validatedRequest, flexUserRoleValid([ROLES.admin])],\n    async (request, response) => {\n      try {\n        const { id } = request.params;\n        const data = reqBody(request);\n        const { router, error } = await ModelRouter.update(Number(id), data);\n        if (error) return response.status(400).json({ router, error });","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/modelRouter.js#L46-L82","documentation":"Uniqueness violation surfaced by ModelRouter.create: a router row with the same name already exists (names are unique), so creation is rejected with 400 to prevent duplicate router names.","triggerScenarios":"Thrown at server/endpoints/modelRouter.js:64 when the library encounters an invalid state.","commonSituations":"Creating a router with a name already in use.","solutions":["Choose a unique router name.","List existing routers to avoid name collisions."],"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-14T05:17:10.506Z"}