{"record":{"id":"576221fd68eba153","repo":"apache/seatunnel","slug":"can-t-find-column-col-in-table","errorCode":null,"errorMessage":"Can't find column ${col} in table.","messagePattern":"Can't find column (.+?) in table\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/util/DorisCatalogUtil.java","lineNumber":273,"sourceCode":"            String col = columnInfo.getName();\n            if (StringUtils.isEmpty(columnInfo.getInfo())) {\n                if (columnMap.containsKey(col)) {\n                    Column column = columnMap.get(col);\n                    String newCol = columnToDorisType(column, typeConverter);\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    static String columnToDorisType(Column column, TypeConverter<BasicTypeDefine> 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(),\n                columnType,","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-doris/src/main/java/org/apache/seatunnel/connectors/doris/util/DorisCatalogUtil.java#L255-L291","documentation":"DorisCatalogUtil.mergeColumnInTemplate fails to locate a column name from the SeaTunnel table schema inside the Doris table template string being modified. When a column referenced for merge/replacement cannot be matched in the template text, it throws this IllegalArgumentException. It is a string-based template manipulation, so exact-name matching is required.","triggerScenarios":"getCreateTableStatement is called with an existing table template whose column list does not contain one of the columns in the SeaTunnel TableSchema (e.g. column renamed, case mismatch, or the template column was removed or renamed in Doris).","commonSituations":"Schema drift between SeaTunnel config and the Doris template; column names differing only in case or backtick/spacing; manually edited template strings; schema evolution where a column was dropped in Doris but still present in the SeaTunnel schema.","solutions":["Ensure column names in the SeaTunnel schema exactly match those in the Doris table template (case, spelling, quoting).","Check the template string for extra spaces or backticks that break the substring match in mergeColumnInTemplate.","Sync the schema: drop and recreate the Doris table from the current SeaTunnel schema.","If schema evolution removed a column from Doris, re-add it or remove it from the source schema before calling catalog createTable."],"exampleFix":"// before\n// schema has column 'userId', Doris template has 'user_id'\n// -> IllegalArgumentException: Can't find column userId in table.\n// after\n// align schema field name with the template column\nSeatTunnelRowType rowType = new SeaTunnelRowType(\n    new String[]{\"user_id\"},\n    new SeaTunnelDataType<?>[]{BasicType.STRING_TYPE});","handlingStrategy":"validation","validationCode":"// verify every schema column appears in the Doris template\nfor (String col : rowType.getFieldNames()) {\n    if (!template.contains(col)) {\n        throw new IllegalStateException(\"Column missing from Doris template: \" + col);\n    }\n}","typeGuard":"boolean templateHasColumn(String template, String col) {\n    return template != null && col != null && template.contains(col);\n}","tryCatchPattern":"try {\n    String stmt = DorisCatalogUtil.getCreateTableStatement(...);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Can't find column\")) {\n        // log offending column, sync schema, retry\n    } else throw e;\n}","preventionTips":["Keep SeaTunnel schema field names identical to Doris column names","Avoid manual edits to table templates","Diff source schema against Doris schema before running catalog DDL"],"tags":["catalog","doris","schema-mismatch"],"backgroundTag":"resource-not-found","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"}