{"record":{"id":"3db0c5fdd8bdff5d","repo":"MyCATApache/Mycat-Server","slug":"err-handle-data","errorCode":"ERR_HANDLE_DATA","errorMessage":"e.toString()","messagePattern":"e\\.toString\\(\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main/java/io/mycat/server/NonBlockingSession.java","lineNumber":154,"sourceCode":"            source.getListener().fireEvent(SqlExecuteStage.END);\n            return;\n        }\n        boolean autocommit = source.isAutocommit();\n        final int initCount = target.size();\n        if (nodes.length == 1) {\n            singleNodeHandler = new SingleNodeHandler(rrs, this);\n            if (this.isPrepared()) {\n                singleNodeHandler.setPrepared(true);\n            }\n\n            try {\n                if(initCount > 1){\n                    checkDistriTransaxAndExecute(rrs,1,autocommit);\n                }else{\n                    singleNodeHandler.execute();\n                }\n            } catch (Exception e) {\n                LOGGER.warn(new StringBuilder().append(source).append(rrs).toString(), e);\n                source.writeErrMessage(ErrorCode.ERR_HANDLE_DATA, e.toString());\n                source.getListener().fireEvent(SqlExecuteStage.END);\n            }\n\n        } else {\n\n            multiNodeHandler = new MultiNodeQueryHandler(type, rrs, autocommit, this);\n            if (this.isPrepared()) {\n                multiNodeHandler.setPrepared(true);\n            }\n            try {\n                if(((type == ServerParse.DELETE || type == ServerParse.INSERT || type == ServerParse.UPDATE) && !rrs.isGlobalTable() && nodes.length > 1)||initCount > 1) {\n                    checkDistriTransaxAndExecute(rrs,2,autocommit);\n                } else {\n                    multiNodeHandler.execute();\n                }\n            } catch (Exception e) {\n                LOGGER.warn(new StringBuilder().append(source).append(rrs).toString(), e);","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/MyCATApache/Mycat-Server/blob/65f8d8beb752f935752f2a0eec0ab017facab9ef/src/main/java/io/mycat/server/NonBlockingSession.java#L136-L172","documentation":"In NonBlockingSession.execute, when a single-node/route query handler throws during execution, the exception is logged and its toString() is sent back to the client as an ERR_HANDLE_DATA error message. The message content is whatever e.toString() yields (e.g. 'java.lang.NullPointerException ...'), not a structured error.","triggerScenarios":"Any Exception escaping SingleNodeHandler.execute() (or checkDistriTransaxAndExecute with initCount>1) during query execution on a session's single-node path.","commonSituations":"Backend MySQL node down or connection broken mid-query; NPE in handler code; query timeout canceling the handler; charset/protocol issues with the backend.","solutions":["Read the full stack trace from the MyCat server log (logged at WARN with source and RouteResultset) — e.toString() alone hides the cause.","Check backend dataNode/host connectivity (show @@heartbeat) since dead connections are the most common trigger.","Retry the query; if persistent, restart the affected MyCat connection pool / backend node."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    singleNodeQuery(sql);\n} catch (SQLException e) {\n    if (e.getErrorCode() == 30003 /* ERR_HANDLE_DATA */) {\n        log.warn(\"MyCat execution failed: \" + e.getMessage(), e);\n        checkBackendHealth();\n        retryOnceWithBackoff();\n    }\n}","preventionTips":["Monitor MyCat heartbeats to backend dataNodes","Set sane connection/timeout settings on backend pools","Always read the server log — client message is only e.toString()"],"tags":["session","execution","backend","generic-exception"],"backgroundTag":"database-query-failed","analyzedSha":"65f8d8beb752f935752f2a0eec0ab017facab9ef","analyzedAt":"2026-09-11T00:12:21.696Z","contentChangedAt":"2026-09-11T00:12:21.696Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}