{"record":{"id":"19bf881865d76644","repo":"apache/iceberg","slug":"invalid-operation-type-s","errorCode":null,"errorMessage":"Invalid operation type: %s","messagePattern":"Invalid operation type: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"api/src/main/java/org/apache/iceberg/expressions/Expression.java","lineNumber":58,"sourceCode":"    IN,\n    NOT_IN,\n    NOT,\n    AND,\n    OR,\n    STARTS_WITH,\n    NOT_STARTS_WITH,\n    COUNT,\n    COUNT_NULL,\n    COUNT_STAR,\n    MAX,\n    MIN;\n\n    public static Operation fromString(String operationType) {\n      Preconditions.checkArgument(null != operationType, \"Invalid operation type: null\");\n      try {\n        return Expression.Operation.valueOf(operationType.toUpperCase(Locale.ROOT));\n      } catch (IllegalArgumentException e) {\n        throw new IllegalArgumentException(\n            String.format(\"Invalid operation type: %s\", operationType), e);\n      }\n    }\n\n    /** Returns the operation used when this is negated. */\n    public Operation negate() {\n      switch (this) {\n        case IS_NULL:\n          return Operation.NOT_NULL;\n        case NOT_NULL:\n          return Operation.IS_NULL;\n        case IS_NAN:\n          return Operation.NOT_NAN;\n        case NOT_NAN:\n          return Operation.IS_NAN;\n        case LT:\n          return Operation.GT_EQ;\n        case LT_EQ:","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/api/src/main/java/org/apache/iceberg/expressions/Expression.java#L40-L76","documentation":"Expression.Operation.fromString parses an operation name (e.g. \"EQ\", \"IS_NULL\") into an Operation enum. It throws IllegalArgumentException when the string is null or not a valid Operation enum constant name. Parsing is case-insensitive via toUpperCase(Locale.ROOT).","triggerScenarios":"Passing a string that is not an Operation name to Operation.fromString — e.g. \"equals\" instead of \"EQ\", a lowercase-but-misspelled token like \"equl\", an alias such as \"==\" or \"not_null\" (underscore form is wrong), or null.","commonSituations":"Deserializing predicate JSON/avro where the operation field was produced by another tool with different naming, hand-written expression strings, or schema/avro files edited manually.","solutions":["Use exact Operation enum constant names, e.g. EQ, NOT_EQ, IS_NULL, IN, NOT_IN, STARTS_WITH","Call Expression.Operation.fromString with the upper-cased canonical name or rely on case-insensitivity but fix spelling","Wrap parsing in try/catch for IllegalArgumentException when handling external input","Print ExpressionUtil describe output to see valid operation names"],"exampleFix":"// before\nOperation op = Operation.fromString(\"equals\");\n// after\nOperation op = Operation.fromString(\"EQ\"); // valid enum constant name","handlingStrategy":"try-catch","validationCode":"boolean valid = operationType != null && Arrays.stream(Expression.Operation.values()).anyMatch(o -> o.name().equalsIgnoreCase(operationType));","typeGuard":"null","tryCatchPattern":"try { op = Expression.Operation.fromString(s); } catch (IllegalArgumentException e) { throw new IllegalArgumentException(\"Unknown predicate operation: \" + s, e); }","preventionTips":["Use canonical enum constant names (EQ, NOT_EQ, IN, ...)","Never pass aliases like == or spelled-out names","Validate operation strings from external sources before parsing"],"tags":["expressions","parsing","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}