{"record":{"id":"a579601030487961","repo":"apache/shardingsphere","slug":"42000-a57960","errorCode":"42000","errorMessage":"You have an error in your SQL syntax: %s","messagePattern":"You have an error in your SQL syntax: (.+?)","errorType":"exception","errorClass":"SQLParsingException","httpStatus":null,"severity":"error","filePath":"parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLStatementVisitorFactory.java","lineNumber":64,"sourceCode":"    }\n    \n    @SneakyThrows(ReflectiveOperationException.class)\n    private static SQLStatementVisitor createParseTreeVisitor(final DatabaseType databaseType, final SQLStatementVisitorFacade visitorFacade, final SQLStatementType type) {\n        switch (type) {\n            case DML:\n                return visitorFacade.getDMLVisitorClass().getConstructor(DatabaseType.class).newInstance(databaseType);\n            case DDL:\n                return visitorFacade.getDDLVisitorClass().getConstructor(DatabaseType.class).newInstance(databaseType);\n            case TCL:\n                return visitorFacade.getTCLVisitorClass().getConstructor(DatabaseType.class).newInstance(databaseType);\n            case LCL:\n                return visitorFacade.getLCLVisitorClass().getConstructor(DatabaseType.class).newInstance(databaseType);\n            case DCL:\n                return visitorFacade.getDCLVisitorClass().getConstructor(DatabaseType.class).newInstance(databaseType);\n            case DAL:\n                return visitorFacade.getDALVisitorClass().getConstructor(DatabaseType.class).newInstance(databaseType);\n            default:\n                throw new SQLParsingException(type.name());\n        }\n    }\n}\n","sourceCodeStart":46,"sourceCodeEnd":68,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/parser/sql/engine/core/src/main/java/org/apache/shardingsphere/sql/parser/engine/core/database/visitor/SQLStatementVisitorFactory.java#L46-L68","documentation":"Thrown by SQLStatementVisitorFactory's default switch case when a SQLStatementType does not map to any visitor category (DML/DDL/TCL/LCL/DCL/DAL). Instead of a SQL syntax message, the payload is just the type name (e.g. 'DQL'), which is a known quirk: the message format string 'You have an error in your SQL syntax: %s' is filled with the type name, not the SQL. It signals an internal routing gap between the parsed statement's category and the available visitor facades.","triggerScenarios":"Parsing a statement whose visitor-required SQLStatementType falls outside the six handled cases — for example a type introduced by a new grammar or an unclassified statement — so newInstance switches hit default. Can also happen if a dialect visitor facade JAR is missing, though usually the failure then occurs earlier at SPI load.","commonSituations":"New statement categories added in newer ShardingSphere grammars but not yet handled by the factory in the running version; mixed-version jars on the classpath (parser engine newer than visitor modules); custom or experimental dialect extensions.","solutions":["Align versions of all shardingsphere parser modules (sql-parser-engine, dialect visitors) so categories and factory cases match","Upgrade to a release where the statement type's visitor branch exists","Avoid the unsupported statement category or rewrite the SQL into a supported one (e.g. DQL-select is DML in this model)","If extending ShardingSphere, add the visitor facade mapping for the new type"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Assert module version alignment before relying on visitor routing\nString engineVersion = SQLParserExecutor.class.getPackage().getImplementationVersion();\nString visitorVersion = SQLStatementVisitorFactory.class.getPackage().getImplementationVersion();\nif (engineVersion != null && !engineVersion.equals(visitorVersion)) throw new IllegalStateException(\"Mixed parser module versions\");","typeGuard":null,"tryCatchPattern":"try { SQLStatementVisitorFactory.newInstance(...); } catch (SQLParsingException e) { throw new IllegalStateException(\"Parser/visitor version mismatch — align ShardingSphere modules\", e); }","preventionTips":["Pin all ShardingSphere artifacts to one BOM-managed version","Run a parse smoke test of each statement category at startup","Avoid custom statement types without extending the visitor factory"],"tags":["sql-parser","visitor-factory","internal","version-mismatch","spi"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}