{"record":{"id":"b1ed8ef9c4cbe327","repo":"MyCATApache/Mycat-Server","slug":"er-unknown-com-error","errorCode":"ER_UNKNOWN_COM_ERROR","errorMessage":"\"Unknown command\"","messagePattern":"\"Unknown command\"","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/net/handler/FrontendCommandHandler.java","lineNumber":131,"sourceCode":"                break;\n            case MySQLPacket.COM_FIELD_LIST:\n                source.fieldList(data);\n                break;\n            case MySQLPacket.COM_SET_OPTION:\n                commands.doSetOption();\n                source.setOption(data);\n                break;\n            case MySQLPacket.COM_RESET_CONNECTION:\n                source.resetConnection();\n                break;\n            default:\n                commands.doOther();\n                MycatConfig config = MycatServer.getInstance().getConfig();\n                if( config.getSystem().getIgnoreUnknownCommand()==1){\n                    LOGGER.warn(\"Unknown command:{}\",data[4]);\n                    source.ping();\n                }else {\n                    LOGGER.error(\"Unknown command:{}\",new String(data));\n                    source.writeErrMessage(ErrorCode.ER_UNKNOWN_COM_ERROR,\n                            \"Unknown command\");\n                }\n        }\n    }\n\n}","sourceCodeStart":113,"sourceCodeEnd":138,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/net/handler/FrontendCommandHandler.java#L113-L138","documentation":"The frontend protocol handler dispatches MySQL client commands by the packet's command byte. When the byte is not a command Mycat implements (and ignoreUnknownCommand != 1), it replies with an ERR packet (ER_UNKNOWN_COM_ERROR, \"Unknown command\").","triggerScenarios":"Client sends a COM_* packet Mycat doesn't support (e.g. COM_CHANGE_USER, COM_RESET_CONNECTION, COM_BINLOG_DUMP, COM_STMT_* prepared-protocol variants) or a corrupted packet whose bytes land in the unhandled default branch of handle().","commonSituations":"Drivers/tools using prepared-statement or replication protocols unsupported by the Mycat version; connection poolers issuing COM_RESET_CONNECTION between checkouts; proxy tools sending COM_CHANGE_USER to re-authenticate.","solutions":["Set <system><property name=\"ignoreUnknownCommand\">1</property></system> in server.xml so unknown commands are answered with a ping instead of an error (for compatible tools)","Upgrade Mycat to a version supporting the command, or use a driver/tool that only uses basic COM_QUERY/COM_PING against Mycat","Disable pooler features like connection reset/change-user on Mycat connections (e.g. disable prepared statement usage or reset-on-return in the pool config)"],"exampleFix":"<!-- before: server.xml -->\n<system/>\n<!-- after -->\n<system>\n  <property name=\"ignoreUnknownCommand\">1</property>\n</system>","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { stmt.execute(sql); } catch (SQLException e) { if (e.getErrorCode() == 1047 /* ER_UNKNOWN_COM_ERROR */) { disableUnsupportedProtocolFeatures(); } else throw e; }","preventionTips":["Set ignoreUnknownCommand=1 in server.xml for tools sending exotic COM_ packets","Use drivers/clients that stick to COM_QUERY/COM_PING against Mycat","Disable pooler reset/change-user and replication features on Mycat connections","Test new drivers and proxy tools against Mycat before rollout"],"tags":["mysql","protocol","command","client-driver"],"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"}