BoundaryML/baml · error

Invalid operator or value type combination

Error message

Invalid operator or value type combination

What it means

The RPC UI filter deserializer matches (operator, value-type) pairs explicitly; any combination not enumerated (e.g. an operator with a value type it cannot handle) hits a catch-all panic. This is an internal invariant violation, not a user-facing validation error.

Solutions

  1. Check which operator/value-type pairs the backend supports and send only those.
  2. Update frontend/backend together so filter schemas match.
  3. Validate operator and value type on the client before constructing the filter.

Example fix

// before
{ "operator": "gt", "value": true }
// after
{ "operator": "eq", "value": true }
Defensive patterns

Strategy: type-guard

Validate before calling

const VALID_COMBOS = {
  eq: ["string", "number", "boolean"],
  ne: ["string", "number", "boolean"],
};
if (!VALID_COMBOS[filter.operator]?.includes(typeof filter.value)) {
  throw new Error(`unsupported operator/value combination: ${filter.operator}/${typeof filter.value}`);
}

Type guard

function isValidFilter(f) {
  return f.operator in { eq: 1, ne: 1 } &&
    ["string", "number", "boolean"].includes(typeof f.value);
}

Prevention

When it happens

Trigger: Building a function-call filter from deserialized JSON where an operator like 'eq'/'ne' is paired with a value type not covered by the match arms (e.g. 'gt' with a Boolean value, or unknown operator strings).

Common situations: Client-side UI code sending a filter whose operator/value type combination the backend doesn't support; API version mismatch between frontend filter builder and backend.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/eaf0b01a02747efa. Report an issue: GitHub.

Appendix: source

Thrown at engine/baml-rpc/src/ui/ui_function_calls.rs:117

                value,
            },
            ("gte", FilterExpressionValue::Number(value)) => FilterExpression::Numeric {
                operator: NumericOperator::Gte,
                value,
            },
            ("lte", FilterExpressionValue::Number(value)) => FilterExpression::Numeric {
                operator: NumericOperator::Lte,
                value,
            },
            ("eq", FilterExpressionValue::Boolean(value)) => FilterExpression::Boolean {
                operator: BooleanOperator::Eq,
                value,
            },
            ("ne", FilterExpressionValue::Boolean(value)) => FilterExpression::Boolean {
                operator: BooleanOperator::Ne,
                value,
            },
            _ => panic!("Invalid operator or value type combination"),
        }
    }
}

#[derive(Debug, Deserialize, Serialize, TS, Clone)]
#[ts(export)]
pub struct TagFilter {
    pub operator: StringOperator,
    pub key: String,
    pub value: String,
}

#[derive(Debug, Deserialize, Serialize, TS, Clone)]
#[ts(export)]
#[serde(untagged)]
pub enum FilterExpression<T> {
    Numeric {
        operator: NumericOperator,

View on GitHub (pinned to bd85ce9dee)