{"record":{"id":"5422dc3ea63264aa","repo":"apache/seatunnel","slug":"can-t-find-column-col-in-table-5422dc","errorCode":null,"errorMessage":"Can't find column ${col} in table.","messagePattern":"Can't find column (.+?) in table\\.","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/catalog/MaxComputeCatalogUtil.java","lineNumber":152,"sourceCode":"            if (StringUtils.isEmpty(columnInfo.getInfo())) {\n                if (columnMap.containsKey(col)) {\n                    Column column = columnMap.get(col);\n                    String newCol =\n                            columnToMaxComputeType(column, MaxComputeTypeConverter.INSTANCE);\n                    String prefix = template.substring(0, columnInfo.getStartIndex() + offset);\n                    String suffix = template.substring(offset + columnInfo.getEndIndex());\n                    if (prefix.endsWith(\"`\")) {\n                        prefix = prefix.substring(0, prefix.length() - 1);\n                        offset--;\n                    }\n                    if (suffix.startsWith(\"`\")) {\n                        suffix = suffix.substring(1);\n                        offset--;\n                    }\n                    template = prefix + newCol + suffix;\n                    offset += newCol.length() - columnInfo.getName().length();\n                } else {\n                    throw new IllegalArgumentException(\"Can't find column \" + col + \" in table.\");\n                }\n            }\n        }\n        return template;\n    }\n\n    public static String columnToMaxComputeType(\n            Column column, TypeConverter<BasicTypeDefine<TypeInfo>> typeConverter) {\n        checkNotNull(column, \"The column is required.\");\n        String columnType;\n        if (column.getSinkType() != null) {\n            columnType = column.getSinkType();\n        } else {\n            columnType = typeConverter.reconvert(column).getColumnType();\n        }\n        return String.format(\n                \"`%s` %s %s %s\",\n                column.getName(),","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-maxcompute/src/main/java/org/apache/seatunnel/connectors/seatunnel/maxcompute/catalog/MaxComputeCatalogUtil.java#L134-L170","documentation":"getCreateTableStatement fills a user-provided DDL template by substituting column definitions from the SeaTunnel catalog table; mergeColumnInTemplate throws IllegalArgumentException when a placeholder column name from the template cannot be matched to any column of the actual table.","triggerScenarios":"save_mode_create_template references a column name that does not exist in the SeaTunnel catalog table being created (typo, renamed field, schema drift between template and source).","commonSituations":"Hand-written DDL templates copied from an older table schema; source schema changed upstream so a template column vanished; case-sensitivity mismatch between template column and SeaTunnel field names.","solutions":["Align the template's column placeholders with the actual SeaTunnel schema field names","Remove stale column placeholders from save_mode_create_template or regenerate it from the current schema","Check field name casing matches exactly between template and source schema"],"exampleFix":"// before\nString template = \"CREATE TABLE ${table} (id BIGINT, old_col STRING)\"; // old_col no longer exists\n// after\nString template = \"CREATE TABLE ${table} (id BIGINT, name STRING)\";   // matches current schema","handlingStrategy":"validation","validationCode":"Set<String> schemaCols = Arrays.stream(rowType.getFieldNames()).collect(Collectors.toSet());\nfor (String col : templateCols) {\n    if (!schemaCols.contains(col)) throw new IllegalArgumentException(\"template col missing in schema: \" + col);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate templates from the live SeaTunnel schema instead of hand-copying DDL","Re-validate templates whenever source schema changes","Match column name casing exactly"],"tags":["maxcompute","template","schema","ddl"],"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-14T16:17:12.679Z"}