{"record":{"id":"a37596310cf0a4cd","repo":"Mintplex-Labs/anything-llm","slug":"type-must-be-one-of-valid-types-join","errorCode":null,"errorMessage":"Type must be one of: ${VALID_TYPES.join(\", \")}","messagePattern":"Type must be one of: (.+?)","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/endpoints/modelRouter.js","lineNumber":126,"sourceCode":"      }\n    }\n  );\n\n  app.post(\n    \"/model-routers/:id/rules/new\",\n    [validatedRequest, flexUserRoleValid([ROLES.admin])],\n    async (request, response) => {\n      try {\n        const { id } = request.params;\n        const user = await userFromSession(request, response);\n        const data = reqBody(request);\n        const routerId = Number(id);\n        const { rule, error } = await ModelRouterRule.create(\n          routerId,\n          data,\n          user?.id || null\n        );\n        if (error) return response.status(400).json({ rule, error });\n\n        await Telemetry.sendTelemetry(\"model_router_rule_created\");\n        ModelRouterService.invalidateRouter(routerId);\n        return response.status(200).json({ rule });\n      } catch (e) {\n        console.error(e);\n        response.sendStatus(500);\n      }\n    }\n  );\n\n  app.put(\n    \"/model-routers/:id/rules/reorder\",\n    [validatedRequest, flexUserRoleValid([ROLES.admin])],\n    async (request, response) => {\n      try {\n        const { id } = request.params;\n        const { ruleUpdates } = reqBody(request);","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/modelRouter.js#L108-L144","documentation":"Validation error propagated from ModelRouterRule.create: the rule's type field is not one of the enumerated VALID_TYPES, so the router cannot interpret the rule and creation is refused with the allowed list.","triggerScenarios":"Thrown at server/endpoints/modelRouter.js:126 when the library encounters an invalid state.","commonSituations":"Rule creation with a type not in the allowed set.","solutions":["Set the rule type to one of the listed valid types.","Check the VALID_TYPES list in server/endpoints/modelRouter.js."],"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"}