{"record":{"id":"17b910d5e2b58298","repo":"MyCATApache/Mycat-Server","slug":"er-unknown-com-error-17b910","errorCode":"ER_UNKNOWN_COM_ERROR","errorMessage":"Unsupported command","messagePattern":"Unsupported command","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/main/java/io/mycat/server/ServerQueryHandler.java","lineNumber":112,"sourceCode":"\t\tcase ServerParse.SELECT:\n\t\t\tSelectHandler.handle(sql, c, rs >>> 8);\n\t\t\tbreak;\n\t\tcase ServerParse.START:\n\t\t\tStartHandler.handle(sql, c, rs >>> 8);\n\t\t\tbreak;\n\t\tcase ServerParse.BEGIN:\n\t\t\tBeginHandler.handle(sql, c);\n\t\t\tbreak;\n\t\t//不支持oracle的savepoint事务回退点\n\t\tcase ServerParse.SAVEPOINT:\n\t\t\tSavepointHandler.handle(sql, c);\n\t\t\tbreak;\n\t\tcase ServerParse.KILL:\n\t\t\tKillHandler.handle(sql, rs >>> 8, c);\n\t\t\tbreak;\n\t\t//不支持KILL_Query\n\t\tcase ServerParse.KILL_QUERY:\n\t\t\tLOGGER.warn(new StringBuilder().append(\"Unsupported command:\").append(sql).toString());\n\t\t\tc.writeErrMessage(ErrorCode.ER_UNKNOWN_COM_ERROR,\"Unsupported command\");\n\t\t\tbreak;\n\t\tcase ServerParse.USE:\n\t\t\tUseHandler.handle(sql, c, rs >>> 8);\n\t\t\tbreak;\n\t\tcase ServerParse.COMMIT:\n\t\t\tc.commit();\n\t\t\tbreak;\n\t\tcase ServerParse.ROLLBACK:\n\t\t\tc.rollback();\n\t\t\tbreak;\n\t\tcase ServerParse.HELP:\n\t\t\tLOGGER.warn(new StringBuilder().append(\"Unsupported command:\").append(sql).toString());\n\t\t\tc.writeErrMessage(ErrorCode.ER_SYNTAX_ERROR, \"Unsupported command\");\n\t\t\tbreak;\n\t\tcase ServerParse.MYSQL_CMD_COMMENT:\n\t\t\tc.write(c.writeToBuffer(OkPacket.OK, c.allocate()));\n\t\t\tbreak;","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/server/ServerQueryHandler.java#L94-L130","documentation":"In ServerQueryHandler.query, the KILL_QUERY command code is deliberately unsupported (the comment notes MyCat does not support it). Instead of dispatching to a handler, the server logs 'Unsupported command:' with the SQL at WARN level and replies to the client with an ER_UNKNOWN_COM_ERROR packet carrying this message. It is a sentinel rejection of an unimplemented MySQL protocol command, not a parser or data failure — the connection stays open and other commands continue to be processed.","triggerScenarios":"Client issues 'KILL QUERY <id>' or the MySQL protocol COM_QUERY form of killing a running query.","commonSituations":"JDBC/drivers or admin tools (mysql client, monitoring) that kill long-running queries; connection-pool validators issuing KILL QUERY on timeouts.","solutions":["Use 'KILL <id>' (whole connection) instead of 'KILL QUERY <id>'.","Kill the query at the backend MySQL directly rather than through MyCat.","Replace pool kill-query behavior with statement/socket timeouts."],"exampleFix":"// before\nKILL QUERY 123;\n// after\nKILL 123;","handlingStrategy":"validation","validationCode":"// Strip/redirect KILL QUERY before sending through MyCat\nString normalized = sql.trim().toUpperCase();\nif (normalized.startsWith(\"KILL QUERY\")) {\n    throw new UnsupportedOperationException(\"KILL QUERY unsupported by MyCat; use KILL or kill on backend MySQL\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    stmt.execute(sql);\n} catch (SQLException e) {\n    if (e.getErrorCode() == 1047 /* ER_UNKNOWN_COM_ERROR */) {\n        backendMySqlConnection(stmt -> stmt.execute(sql));\n    }\n}","preventionTips":["Never issue KILL QUERY via MyCat proxies","Configure pool evictors to close connections instead of killing queries","Use MyCat management port (show @@connection / kill @@connection) for session management"],"tags":["kill-query","unsupported-command","protocol"],"backgroundTag":"unsupported-operation","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}