{"record":{"id":"10a7bb1262564b32","repo":"apache/seatunnel","slug":"cannot-compare-values-of-type-s-and-s","errorCode":null,"errorMessage":"Cannot compare values of type %s and %s","messagePattern":"Cannot compare values of type (.+?) and (.+?)","errorType":"validation","errorClass":"org.apache.seatunnel.api.configuration.util.OptionValidationException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/ConditionEvaluators.java","lineNumber":197,"sourceCode":"            }\n        }\n        return Collections.unmodifiableMap(m);\n    }\n\n    @SuppressWarnings({\"rawtypes\"})\n    static int compareNumbers(Object a, Object b) {\n        if (a == null || b == null) {\n            throw new OptionValidationException(\n                    \"Cannot compare null values in numeric comparison: leftPresent=%s, rightPresent=%s\",\n                    a != null, b != null);\n        }\n        if (a instanceof Number && b instanceof Number) {\n            return compareNumberValues((Number) a, (Number) b);\n        }\n        if (a instanceof Comparable && b instanceof Comparable) {\n            return ((Comparable) a).compareTo(b);\n        }\n        throw new OptionValidationException(\n                \"Cannot compare values of type %s and %s\",\n                a.getClass().getSimpleName(), b.getClass().getSimpleName());\n    }\n\n    private static int compareNumberValues(Number a, Number b) {\n        if (a instanceof BigDecimal || b instanceof BigDecimal) {\n            BigDecimal bdA =\n                    a instanceof BigDecimal ? (BigDecimal) a : new BigDecimal(a.toString());\n            BigDecimal bdB =\n                    b instanceof BigDecimal ? (BigDecimal) b : new BigDecimal(b.toString());\n            return bdA.compareTo(bdB);\n        }\n        if (a instanceof Double\n                || a instanceof Float\n                || b instanceof Double\n                || b instanceof Float) {\n            return Double.compare(a.doubleValue(), b.doubleValue());\n        }","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/ConditionEvaluators.java#L179-L215","documentation":"Thrown from ConditionEvaluators.compareNumbers when both operands are non-null but neither pair of types is mutually comparable: they are not both Numbers and not both Comparables of compatible type. At its throw site it means the conditional expression compares values of mismatched kinds (e.g. a string against a number, or a list against a scalar); the guard reports the two runtime classes so the mis-typed operand in the condition can be located.","triggerScenarios":"Thrown at seatunnel-api/src/main/java/org/apache/seatunnel/api/configuration/util/ConditionEvaluators.java:197 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make both sides of the condition the same type — quote string values or write numeric literals without quotes in the config","Check the option's declared type in its Option definition and write the comparison value to match","If comparing enums or custom types, ensure both operands implement Comparable with a common comparable type"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}