{"record":{"id":"d236077398439ab4","repo":"apache/seatunnel","slug":"commonerrorcodedeprecated-illegal-argument-d23607","errorCode":"CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT","errorMessage":"field not found in written table: %s,rowType: %s","messagePattern":"field not found in written table: (.+?),rowType: (.+?)","errorType":"error_code","errorClass":"org.apache.seatunnel.connectors.seatunnel.maxcompute.exception.MaxcomputeConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/util/MaxcomputeTypeMapper.java","lineNumber":79,"sourceCode":"    public static SeaTunnelRow getSeaTunnelRowData(Record rs, SeaTunnelRowType typeInfo) {\n        List<Object> fields = new ArrayList<>();\n        for (int i = 0; i < typeInfo.getTotalFields(); i++) {\n            String typeName = typeInfo.getFieldName(i);\n            fields.add(resolveObject2SeaTunnel(rs.get(typeName), typeInfo.getFieldType(i)));\n        }\n        return new SeaTunnelRow(fields.toArray());\n    }\n\n    public static Record getMaxcomputeRowData(\n            Record record,\n            SeaTunnelRow seaTunnelRow,\n            TableSchema tableSchema,\n            SeaTunnelRowType rowType,\n            FormatterContext formatterContext) {\n        for (int i = 0; i < seaTunnelRow.getFields().length; i++) {\n            String fieldName = rowType.getFieldName(i);\n            if (!tableSchema.containsColumn(fieldName)) {\n                throw new MaxcomputeConnectorException(\n                        CommonErrorCodeDeprecated.ILLEGAL_ARGUMENT,\n                        String.format(\n                                \"field not found in written table: %s,rowType: %s\",\n                                fieldName, seaTunnelRow.getField(i)));\n            }\n            Column column = tableSchema.getColumn(fieldName);\n\n            record.set(\n                    tableSchema.getColumnIndex(fieldName),\n                    resolveObject2Maxcompute(\n                            seaTunnelRow.getField(i), column.getTypeInfo(), formatterContext));\n        }\n        return record;\n    }\n\n    public static SeaTunnelRowType getSeaTunnelRowType(ReadonlyConfig config) {\n        Table table = MaxcomputeUtil.getTable(config);\n        TableSchema tableSchema = table.getSchema();","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/util/MaxcomputeTypeMapper.java#L61-L97","documentation":"While mapping a SeaTunnelRow to a MaxCompute row, getMaxcomputeRowData looks up each field name (by position) in the target ODPS TableSchema; if the writer's SeaTunnelRowType contains a field absent from the physical table, it throws MaxcomputeConnectorException(ILLEGAL_ARGUMENT, 'field not found in written table: <field>,rowType: <value>').","triggerScenarios":"Downstream MaxCompute table schema does not contain a column present in the SeaTunnel row type — e.g., the source added a column after the ODPS table was created, or the sink was pointed at a different table than intended.","commonSituations":"Source schema evolved (new column) while the MaxCompute table was not altered; typos in transform-generated field names; writing to a table in a different project/environment with an older schema.","solutions":["ALTER TABLE the MaxCompute table to add the missing column (ADD COLUMNS)","Reconcile the SeaTunnel row type with the table schema (drop/rename the extra field via a transform or corrected source config)","Verify table_path points at the intended table and environment","Regenerate the ODPS table from the catalog create statement matching the current schema"],"exampleFix":"// before\nseaTunnelRowType: [id, name, new_col]  // ODPS table lacks new_col\n// after\nALTER TABLE my_table ADD COLUMNS IF NOT EXISTS (new_col STRING);","handlingStrategy":"validation","validationCode":"for (String name : rowType.getFieldNames()) {\n    if (!tableSchema.containsColumn(name)) {\n        throw new IllegalStateException(\"ODPS table missing column: \" + name);\n    }\n}","typeGuard":null,"tryCatchPattern":"try { mapper.getMaxcomputeRowData(row, tableSchema, rowType, ctx); }\ncatch (MaxcomputeConnectorException e) {\n    throw new SchemaEvolutionException(\"Alter the MaxCompute table or drop the extra field\", e);\n}","preventionTips":["Compare rowType field names against TableSchema before writing","Automate ALTER TABLE ADD COLUMNS on schema evolution","Confirm table_path targets the right project/table","Keep source and sink schema definitions in sync"],"tags":["maxcompute","type-mapping","schema-mismatch","sink"],"backgroundTag":"schema-validation-failed","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"}