{"record":{"id":"5eaac1b03b28d83f","repo":"apache/seatunnel","slug":"the-sink-table-s-is-not-found","errorCode":null,"errorMessage":"The sink table[%s] is not found","messagePattern":"The sink table\\[(.+?)\\] is not found","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":417,"sourceCode":"                String query = select.toString();\n                transformConfig.setPluginInputIdentifier(pluginInputIdentifier);\n                transformConfig.setPluginOutputIdentifier(pluginOutputIdentifier);\n                transformConfig.setQuery(query);\n                seaTunnelConfig.getTransformConfigs().add(transformConfig);\n            }\n\n            if (!sqlTables.containsKey(pluginInputIdentifier)\n                    || (!OPTION_TABLE_TYPE_SOURCE.equalsIgnoreCase(\n                                    sqlTables.get(pluginInputIdentifier).getType())\n                            && !OPTION_TABLE_TYPE_TRANSFORM.equalsIgnoreCase(\n                                    sqlTables.get(pluginInputIdentifier).getType()))) {\n                throw new ParserException(\n                        String.format(\"The source table[%s] is not found\", pluginInputIdentifier));\n            }\n            if (!sqlTables.containsKey(targetTableName)\n                    || !OPTION_TABLE_TYPE_SINK.equalsIgnoreCase(\n                            sqlTables.get(targetTableName).getType())) {\n                throw new ParserException(\n                        String.format(\"The sink table[%s] is not found\", pluginInputIdentifier));\n            }\n\n            SinkConfig sinkConfig = (SinkConfig) sqlTables.get(targetTableName);\n            SinkConfig sinkConfigNew = new SinkConfig();\n            sinkConfigNew.setConnector(sinkConfig.getConnector());\n            sinkConfigNew.setPluginInputIdentifier(pluginOutputIdentifier);\n            sinkConfigNew.getOptions().addAll(sinkConfig.getOptions());\n            sinkConfigNew\n                    .getOptions()\n                    .add(Option.of(OPTION_PLUGIN_INPUT_KEY, \"\\\"\" + pluginOutputIdentifier + \"\\\"\"));\n\n            seaTunnelConfig.getSinkConfigs().add(sinkConfigNew);\n        } else {\n            throw new ParserException(\"Unsupported syntax: \" + insertSql);\n        }\n    }\n","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-config/seatunnel-config-sql/src/main/java/org/apache/seatunnel/config/sql/SqlConfigBuilder.java#L399-L435","documentation":"Thrown by parseInsertSql when the INSERT target table either does not exist in sqlTables or is not of type 'sink'. Note the message prints pluginInputIdentifier (the source name) instead of the target name — a known message bug — but the check is against targetTableName.","triggerScenarios":"INSERT INTO t SELECT ... where t was never declared via CREATE TABLE WITH ('connector'=...), or t was declared as a source/transform rather than a sink.","commonSituations":"Forgetting the sink CREATE TABLE before the INSERT; declaring the target without 'table_type'='sink'; mistyped target name; confusion caused by the error message showing the wrong table name.","solutions":["Declare the target with CREATE TABLE t WITH ('connector'=...,'table_type'='sink') before the INSERT","Ensure the target name matches the INSERT INTO identifier exactly","If the message shows the source table name, still check the INSERT INTO target table's existence and type — the message text is misleading"],"exampleFix":"// before\nINSERT INTO sink_t SELECT * FROM src -- sink_t undeclared\n// after\nCREATE TABLE sink_t WITH ('connector'='console','table_type'='sink');\nINSERT INTO sink_t SELECT * FROM src","handlingStrategy":"validation","validationCode":"// before the INSERT, check the INSERT INTO target is declared as a sink\nif (!declaredTables.containsKey(targetTable)\n        || !\"sink\".equalsIgnoreCase(declaredTables.get(targetTable).getType())) {\n    throw new IllegalArgumentException(\"INSERT INTO target \" + targetTable + \" must be declared as a sink table first\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    SeaTunnelConfig c = SqlConfigBuilder.of(sql);\n} catch (ParserException e) {\n    if (e.getMessage().startsWith(\"The sink table[\")) {\n        // NOTE: message may print the source name; validate the INSERT INTO target table's declaration/type\n    }\n}","preventionTips":["Declare the sink table with 'table_type'='sink' before any INSERT INTO it","Match the INSERT INTO identifier to the declared sink name exactly","Remember the error message may show the source table name; always inspect the INSERT INTO target when this fires"],"tags":["sql","parser","insert","unknown-table"],"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-14T05:17:10.506Z"}