{"record":{"id":"82285472b3063389","repo":"apache/seatunnel","slug":"cannot-convert-to-uuid","errorCode":null,"errorMessage":"Cannot convert to UUID: ","messagePattern":"Cannot convert to UUID: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/data/RowConverter.java","lineNumber":372,"sourceCode":"            } else if (value instanceof Number || value instanceof Boolean) {\n                return value.toString();\n            } else if (value instanceof Map || value instanceof List) {\n                return MAPPER.writeValueAsString(value);\n            } else {\n                return MAPPER.writeValueAsString(value);\n            }\n        } catch (IOException e) {\n            throw new UncheckedIOException(e);\n        }\n    }\n\n    protected UUID convertUUID(Object value) {\n        if (value instanceof String) {\n            return UUID.fromString((String) value);\n        } else if (value instanceof UUID) {\n            return (UUID) value;\n        }\n        throw new IllegalArgumentException(\"Cannot convert to UUID: \" + value.getClass().getName());\n    }\n\n    protected ByteBuffer convertBase64Binary(Object value) {\n        if (value instanceof String) {\n            return ByteBuffer.wrap(Base64.getDecoder().decode((String) value));\n        } else if (value instanceof byte[]) {\n            return ByteBuffer.wrap((byte[]) value);\n        } else if (value instanceof ByteBuffer) {\n            return (ByteBuffer) value;\n        }\n        throw new IllegalArgumentException(\n                \"Cannot convert to binary: \" + value.getClass().getName());\n    }\n\n    protected LocalDate convertDateValue(Object value) {\n        if (value instanceof Number) {\n            int days = ((Number) value).intValue();\n            return DateTimeUtil.dateFromDays(days);","sourceCodeStart":354,"sourceCodeEnd":390,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-iceberg/src/main/java/org/apache/seatunnel/connectors/seatunnel/iceberg/data/RowConverter.java#L354-L390","documentation":"Iceberg RowConverter throws this when a UUID column value is neither String nor java.util.UUID. convertUUID only supports those two types; any other object (byte[16], Long, etc.) is rejected with the value's class name in the message.","triggerScenarios":"convertUUID receives a byte[] or other type while writing to an Iceberg UUID column, e.g. when a source connector represents UUIDs as fixed 16-byte binary.","commonSituations":"Postgres/MySQL UUID columns decoded as byte[] by a JDBC source; CDC records carrying UUID as binary; schema evolution changed the column type.","solutions":["Convert the value to String (e.g. UUID.toString() or hex-decode byte[]) before the sink.","Add a transform to cast the column to STRING so convertUUID parses it via UUID.fromString.","Fix the source connector type mapping to emit SeaTunnel StringType for UUID columns."],"exampleFix":"// before\nwriter.write(idx, uuidBytes); // byte[16]\n// after\nByteBuffer bb = ByteBuffer.wrap(uuidBytes);\nwriter.write(idx, new UUID(bb.getLong(), bb.getLong())); // java.util.UUID accepted","handlingStrategy":"type-guard","validationCode":"if (!(v instanceof UUID) && !(v instanceof String)) throw new IllegalArgumentException(\"uuid column must be UUID/String, got \" + (v == null ? \"null\" : v.getClass().getName()));","typeGuard":"boolean isUuidConvertible(Object v) { return v instanceof UUID || v instanceof String; }","tryCatchPattern":"try { sink.write(row); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Cannot convert to UUID\")) { /* convert byte[16] to UUID or DLQ */ } else throw e; }","preventionTips":["Configure sources to emit UUID columns as strings","CAST uuid/binary(16) columns to STRING upstream","Validate Iceberg schema UUID columns match source logical types"],"tags":["iceberg","type-conversion","uuid","sink"],"backgroundTag":"type-mismatch","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"}