Mintplex-Labs/anything-llm · error

Condition ${i + 1}: comparator must be one of: ${VALID_COMPA

Error message

Condition ${i + 1}: comparator must be one of: ${VALID_COMPARATORS.join(", ")}

What it means

Validation error from ModelRouterRule.create: condition i+1 in the payload used a comparator string outside the VALID_COMPARATORS whitelist, so the rule's matching logic would be undefined and creation is rejected.

Source

Thrown at server/endpoints/modelRouter.js:126

      }
    }
  );

  app.post(
    "/model-routers/:id/rules/new",
    [validatedRequest, flexUserRoleValid([ROLES.admin])],
    async (request, response) => {
      try {
        const { id } = request.params;
        const user = await userFromSession(request, response);
        const data = reqBody(request);
        const routerId = Number(id);
        const { rule, error } = await ModelRouterRule.create(
          routerId,
          data,
          user?.id || null
        );
        if (error) return response.status(400).json({ rule, error });

        await Telemetry.sendTelemetry("model_router_rule_created");
        ModelRouterService.invalidateRouter(routerId);
        return response.status(200).json({ rule });
      } catch (e) {
        console.error(e);
        response.sendStatus(500);
      }
    }
  );

  app.put(
    "/model-routers/:id/rules/reorder",
    [validatedRequest, flexUserRoleValid([ROLES.admin])],
    async (request, response) => {
      try {
        const { id } = request.params;
        const { ruleUpdates } = reqBody(request);

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Set the comparator to one of the listed valid comparators.
  2. Check VALID_COMPARATORS in the endpoint source.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/endpoints/modelRouter.js:126 when the library encounters an invalid state.

Common situations: A rule condition used an unsupported comparator.


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/8c7a7c3a905a331b. Report an issue: GitHub.