{"record":{"id":"eaf0b01a02747efa","repo":"BoundaryML/baml","slug":"invalid-operator-or-value-type-combination","errorCode":null,"errorMessage":"Invalid operator or value type combination","messagePattern":"Invalid operator or value type combination","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-rpc/src/ui/ui_function_calls.rs","lineNumber":117,"sourceCode":"                value,\n            },\n            (\"gte\", FilterExpressionValue::Number(value)) => FilterExpression::Numeric {\n                operator: NumericOperator::Gte,\n                value,\n            },\n            (\"lte\", FilterExpressionValue::Number(value)) => FilterExpression::Numeric {\n                operator: NumericOperator::Lte,\n                value,\n            },\n            (\"eq\", FilterExpressionValue::Boolean(value)) => FilterExpression::Boolean {\n                operator: BooleanOperator::Eq,\n                value,\n            },\n            (\"ne\", FilterExpressionValue::Boolean(value)) => FilterExpression::Boolean {\n                operator: BooleanOperator::Ne,\n                value,\n            },\n            _ => panic!(\"Invalid operator or value type combination\"),\n        }\n    }\n}\n\n#[derive(Debug, Deserialize, Serialize, TS, Clone)]\n#[ts(export)]\npub struct TagFilter {\n    pub operator: StringOperator,\n    pub key: String,\n    pub value: String,\n}\n\n#[derive(Debug, Deserialize, Serialize, TS, Clone)]\n#[ts(export)]\n#[serde(untagged)]\npub enum FilterExpression<T> {\n    Numeric {\n        operator: NumericOperator,","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-rpc/src/ui/ui_function_calls.rs#L99-L135","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Check which operator/value-type pairs the backend supports and send only those.","Update frontend/backend together so filter schemas match.","Validate operator and value type on the client before constructing the filter."],"exampleFix":"// before\n{ \"operator\": \"gt\", \"value\": true }\n// after\n{ \"operator\": \"eq\", \"value\": true }","handlingStrategy":"type-guard","validationCode":"const VALID_COMBOS = {\n  eq: [\"string\", \"number\", \"boolean\"],\n  ne: [\"string\", \"number\", \"boolean\"],\n};\nif (!VALID_COMBOS[filter.operator]?.includes(typeof filter.value)) {\n  throw new Error(`unsupported operator/value combination: ${filter.operator}/${typeof filter.value}`);\n}","typeGuard":"function isValidFilter(f) {\n  return f.operator in { eq: 1, ne: 1 } &&\n    [\"string\", \"number\", \"boolean\"].includes(typeof f.value);\n}","tryCatchPattern":null,"preventionTips":["Keep frontend filter-builder and backend match arms in sync.","Validate filters client-side before sending to the RPC endpoint."],"tags":["rpc","filter","panic","internal"],"backgroundTag":"internal-invariant-violation","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}