{"record":{"id":"71f0ce7ddd3ce0c4","repo":"apache/seatunnel","slug":"columndefine-size-not-match","errorCode":null,"errorMessage":"columnDefine size not match","messagePattern":"columnDefine size not match","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/DataConverter.java","lineNumber":64,"sourceCode":"        return convert(columnDefine.getDataType(), value);\n    }\n\n    default Object convert(T typeDefine, Column columnDefine, Object value) {\n        return convert(columnDefine, value);\n    }\n\n    default Object[] convert(T[] typeDefine, Column[] columnDefine, Object[] value) {\n        for (int i = 0; i < value.length; i++) {\n            value[i] =\n                    convert(typeDefine != null ? typeDefine[i] : null, columnDefine[i], value[i]);\n        }\n        return value;\n    }\n\n    default Object[] convert(Column[] columnDefine, Function<Column[], Object[]> valueApply) {\n        Object[] fields = valueApply.apply(columnDefine);\n        if (fields.length != columnDefine.length) {\n            throw new IllegalStateException(\"columnDefine size not match\");\n        }\n\n        for (int i = 0; i < fields.length; i++) {\n            fields[i] = convert(columnDefine[i], fields[i]);\n        }\n        return fields;\n    }\n\n    default Object[] convert(\n            T[] typeDefine, Column[] columnDefine, BiFunction<T[], Column[], Object[]> valueApply) {\n        boolean hasTypeDefine = typeDefine != null;\n        if (hasTypeDefine && typeDefine.length != columnDefine.length) {\n            throw new IllegalStateException(\"typeDefine size not match\");\n        }\n\n        Object[] fields = valueApply.apply(typeDefine, columnDefine);\n        if (fields.length != columnDefine.length) {\n            throw new IllegalStateException(\"columnDefine size not match\");","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/DataConverter.java#L46-L82","documentation":"DataConverter.convert(Column[], Function) applies the value producer and then requires that the produced Object[] length equals the number of Column definitions, converting each field with its column. A length mismatch means the row data and the schema are out of sync, so it fails fast with IllegalStateException.","triggerScenarios":"The Function<Column[], Object[]> passed to convert returns an array whose length differs from columnDefine.length.","commonSituations":"ResultSet column count changed after schema was built; SELECT list altered; schema derived from a stale/mismatched table definition.","solutions":["Rebuild the Column[] schema from the same source that produced the values","Ensure the value producer reads exactly the columns in columnDefine (same order and count)","Check for schema drift between the connector's cached schema and the live source"],"exampleFix":"// before\nObject[] row = readAllColumns(rs); // 12 values vs 11 columns\n// after\nObject[] row = new Object[columnDefine.length];\nfor (int i = 0; i < columnDefine.length; i++) row[i] = rs.getObject(i + 1);","handlingStrategy":"validation","validationCode":"Object[] fields = valueApply.apply(columnDefine);\nif (fields.length != columnDefine.length) {\n    throw new IllegalArgumentException(\"row has \" + fields.length + \" fields but schema has \" + columnDefine.length);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object[] out = dataConverter.convert(columnDefine, valueApply);\n} catch (IllegalStateException e) {\n    log.error(\"Schema/row mismatch detected: {}\", e.getMessage());\n    throw e;\n}","preventionTips":["Build schema and row extraction from the same metadata snapshot","Re-read schema after any source DDL change","Add row-length assertions in your reader"],"tags":["java","schema","data-conversion"],"backgroundTag":"shape-mismatch","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}