{"record":{"id":"549bd892f5c1278e","repo":"apache/seatunnel","slug":"typedefine-size-not-match","errorCode":null,"errorMessage":"typeDefine size not match","messagePattern":"typeDefine 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":77,"sourceCode":"    }\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\");\n        }\n\n        for (int i = 0; i < fields.length; i++) {\n            fields[i] = convert(hasTypeDefine ? typeDefine[i] : null, columnDefine[i], fields[i]);\n        }\n        return fields;\n    }\n\n    default Object reconvert(T typeDefine, Column columnDefine, Object value) {\n        return reconvert(typeDefine, value);\n    }\n\n    /**","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-api/src/main/java/org/apache/seatunnel/api/table/converter/DataConverter.java#L59-L95","documentation":"DataConverter.convert(T[], Column[], BiFunction) first validates that typeDefine and columnDefine arrays have equal length; each type definition must correspond to exactly one column. Unequal lengths indicate the converter-specific type metadata and the SeaTunnel schema were built from different sources, so it throws IllegalStateException.","triggerScenarios":"Passing a T[] typeDefine array sized differently from the Column[] array, e.g. after columns were added/dropped in one but not the other.","commonSituations":"Schema evolution (ALTER TABLE) applied to the source but the connector's cached converter types were not refreshed; hand-built mismatched arrays in custom code.","solutions":["Regenerate typeDefine and columnDefine from the same schema snapshot","Verify the length equality before calling convert","Clear/rebuild cached catalog metadata after DDL changes"],"exampleFix":"// before\nconvert(typeDefines, columnDefines, apply); // 10 vs 11\n// after\nif (typeDefines.length != columnDefines.length) {\n    throw new IllegalArgumentException(\"refresh schema: \" + typeDefines.length + \" vs \" + columnDefines.length);\n}\nconvert(typeDefines, columnDefines, apply);","handlingStrategy":"validation","validationCode":"if (typeDefine != null && typeDefine.length != columnDefine.length) {\n    throw new IllegalArgumentException(\"typeDefine/columnDefine length mismatch: \" + typeDefine.length + \" vs \" + columnDefine.length);\n}","typeGuard":null,"tryCatchPattern":"try {\n    Object[] out = dataConverter.convert(typeDefine, columnDefine, valueApply);\n} catch (IllegalStateException e) {\n    log.error(\"Converter type metadata out of sync with schema: {}\", e.getMessage());\n    throw e;\n}","preventionTips":["Regenerate typeDefine together with columnDefine from one catalog call","Invalidate cached schema on DDL events","Write a startup sanity check comparing array lengths"],"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"}