infiniflow/ragflow · error · ValueError

Not supported operator

Error message

Not supported operator: {operator}

What it means

ValueError from Switch's condition evaluation (after the ≥/≤ branches shown). When none of the implemented operators match — contains, not contains, start with, end with, empty, not empty, =, ≠, >, <, ≥, ≤ — the fall-through raises 'Not supported operator'.

Solutions

  1. Pick the operator from the Switch UI dropdown so the canonical token is stored.
  2. If writing DSL, restrict operators to: contains, not contains, start with, end with, empty, not empty, =, ≠, >, <, ≥, ≤.
  3. Replace '>=' with '≥' and '<=' with '≤' in existing conditions.

Example fix

// before
{"operator": ">=", "value": 10}

// after
{"operator": "≥", "value": 10}
Defensive patterns

Strategy: validation

Validate before calling

SWITCH_OPS = {'contains', 'not contains', 'start with', 'end with', 'empty', 'not empty', '=', '≠', '>', '<', '≥', '≤'}
for cond in switch_param.conditions:
    assert cond['operator'] in SWITCH_OPS, cond['operator']

Type guard

def is_switch_operator(op: str) -> bool:
    return op in {'contains', 'not contains', 'start with', 'end with', 'empty', 'not empty', '=', '≠', '>', '<', '≥', '≤'}

Try / catch

try:
    switch._invoke()
except ValueError as e:
    if 'Not supported operator' in str(e):
        # replace with a supported operator token and re-run
        ...

Prevention

When it happens

Trigger: A Switch condition whose operator is anything outside the SwitchParam.operators list: typos like 'starts with', '>=' instead of '≥', 'equals' instead of '=', or a localized label. Note Switch uses '≥'/'≤' Unicode forms, not ASCII '>='/'<='.

Common situations: Hand-editing canvas DSL with ASCII comparison operators; copying conditions from the Categorize or Loop components which use different operator vocabularies; templates authored against an older operator set.

Related errors


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/18ff5833d12f6486. Report an issue: GitHub.

Appendix: source

Thrown at agent/component/switch.py:135

            except Exception:
                return True if input > value else False
        elif operator == "<":
            try:
                return True if float(input) < float(value) else False
            except Exception:
                return True if input < value else False
        elif operator == "≥":
            try:
                return True if float(input) >= float(value) else False
            except Exception:
                return True if input >= value else False
        elif operator == "≤":
            try:
                return True if float(input) <= float(value) else False
            except Exception:
                return True if input <= value else False

        raise ValueError(f"Not supported operator: {operator}")

    def thoughts(self) -> str:
        return "I’m weighing a few options and will pick the next step shortly."

View on GitHub (pinned to 554fb1133a)