{"record":{"id":"4b865b5757feef25","repo":"apache/seatunnel","slug":"table-name-duplicate-s","errorCode":null,"errorMessage":"Table name duplicate: %s","messagePattern":"Table name duplicate: (.+?)","errorType":"exception","errorClass":"ParserException","httpStatus":null,"severity":"error","filePath":"seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java","lineNumber":245,"sourceCode":"                sqlList.add(sqlSj.toString());\n                sqlSj = new StringJoiner(\" \");\n            } else {\n                sqlSj.add(line);\n            }\n        }\n        return sqlList;\n    }\n\n    private static void parseCreateTableSql(\n            CreateTable createTable,\n            Map<String, BaseConfig> sqlTables,\n            SeaTunnelConfig seaTunnelConfig) {\n\n        Map<String, String> optionsMap = parseOptions(createTable);\n\n        String tableName = createTable.getTable().getName();\n        if (sqlTables.containsKey(tableName)) {\n            throw new ParserException(String.format(\"Table name duplicate: %s\", tableName));\n        }\n        String type = optionsMap.get(OPTION_TABLE_TYPE_KEY);\n        if (OPTION_TABLE_TYPE_SOURCE.equalsIgnoreCase(type)) {\n            SourceConfig sourceConfig = parseSourceSql(createTable, optionsMap);\n            sqlTables.put(tableName, sourceConfig);\n            seaTunnelConfig.getSourceConfigs().add(sourceConfig);\n        } else if (OPTION_TABLE_TYPE_SINK.equalsIgnoreCase(type)) {\n            SinkConfig sinkConfig = parseSinkSql(optionsMap);\n            sqlTables.put(tableName, sinkConfig);\n            seaTunnelConfig.getSinkConfigs().add(sinkConfig);\n        }\n    }\n\n    private static Map<String, String> parseOptions(CreateTable createTable) {\n        String options = createTable.getTableOptionsStrings().get(1);\n        options = options.substring(0, options.length() - 1).substring(1);\n        String[] optionItems = options.split(OPTION_DELIMITER);\n        Map<String, String> optionsMap = new LinkedHashMap<>();","sourceCodeStart":227,"sourceCodeEnd":263,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java#L227-L263","documentation":"parseCreateTableSql rejects duplicate table names: if a second CREATE TABLE declares a name already present in sqlTables, it throws ParserException 'Table name duplicate'. Each table name in a seatunnel SQL config must be unique because names are used as map keys and as plugin_input/plugin_output identifiers.","triggerScenarios":"Declaring two CREATE TABLE statements with the same name (e.g. redefining a source with different options), or accidentally copy-pasting a table block twice in the .sql file.","commonSituations":"Merging multiple config files where each declares the same table, iterating a config generator that emits the old definition twice, defining two sources but reusing one name instead of distinct names.","solutions":["Rename one of the duplicate tables and update the INSERT ... SELECT references.","Delete the stale duplicate CREATE TABLE definition.","Use distinct table names and distinct plugin_output identifiers per connector instance.","Unify options into one table instead of redefining it with different WITH options."],"exampleFix":"// before\nCREATE TABLE src WITH ('connector'='fake', 'type'='source') (id INT);\nCREATE TABLE src WITH ('connector'='kafka', 'type'='source') (id INT); -- duplicate\n// after\nCREATE TABLE src_fake WITH ('connector'='fake', 'type'='source') (id INT);\nCREATE TABLE src_kafka WITH ('connector'='kafka', 'type'='source') (id INT);","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (String line : lines) {\n    Matcher m = Pattern.compile(\"CREATE TABLE\\\\s+(\\\\w+)\").matcher(line);\n    if (m.find() && !seen.add(m.group(1))) throw new IllegalStateException(\"Duplicate table: \" + m.group(1));\n}","typeGuard":null,"tryCatchPattern":"try { Config c = SqlConfigBuilder.of(sqlFile); } catch (ParserException e) { if (e.getMessage().startsWith(\"Table name duplicate\")) { /* rename/delete the table named in the message */ } }","preventionTips":["Enforce unique CREATE TABLE names per file","When merging configs, check for name collisions","Use distinct table names per connector instance","Grep for CREATE TABLE names before submission"],"tags":["sql-config","duplicate-definition","config-validation","java"],"backgroundTag":"invalid-config-value","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}