{"record":{"id":"725e0cd14f6af142","repo":"OtterMind/Chat2DB","slug":"invalid-geometry-inputstream-less-than-five-byte-725e0c","errorCode":null,"errorMessage":"Invalid geometry inputStream - less than five bytes","messagePattern":"Invalid geometry inputStream - less than five bytes","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"chat2db-community-server/chat2db-community-plugins/chat2db-community-mysql/src/main/java/ai/chat2db/plugin/mysql/value/sub/MysqlGeometryProcessor.java","lineNumber":43,"sourceCode":"\n    @Override\n    public String convertJDBCValueByType(JDBCDataValue dataValue) {\n        try {\n            InputStream inputStream = dataValue.getBinaryStream();\n            Geometry dbGeometry = null;\n            if (inputStream != null) {\n                byte[] buffer = new byte[255];\n\n                int bytesRead = 0;\n                ByteArrayOutputStream baos = new ByteArrayOutputStream();\n                while ((bytesRead = inputStream.read(buffer)) != -1) {\n                    baos.write(buffer, 0, bytesRead);\n                }\n\n                byte[] geometryAsBytes = baos.toByteArray();\n\n                if (geometryAsBytes.length < 5) {\n                    throw new Exception(\"Invalid geometry inputStream - less than five bytes\");\n                }\n                byte[] sridBytes = new byte[4];\n                System.arraycopy(geometryAsBytes, 0, sridBytes, 0, 4);\n                boolean bigEndian = (geometryAsBytes[4] == 0x00);\n\n                int srid = 0;\n                if (bigEndian) {\n                    for (int i = 0; i < sridBytes.length; i++) {\n                        srid = (srid << 8) + (sridBytes[i] & 0xff);\n                    }\n                } else {\n                    for (int i = 0; i < sridBytes.length; i++) {\n                        srid += (sridBytes[i] & 0xff) << (8 * i);\n                    }\n                }\n                WKBReader wkbReader = new WKBReader();\n                byte[] wkb = new byte[geometryAsBytes.length - 4];\n                System.arraycopy(geometryAsBytes, 4, wkb, 0, wkb.length);","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-plugins/chat2db-community-mysql/src/main/java/ai/chat2db/plugin/mysql/value/sub/MysqlGeometryProcessor.java#L25-L61","documentation":"Error \"Invalid geometry inputStream - less than five bytes\" thrown in OtterMind/Chat2DB.","triggerScenarios":"The MySQL geometry processor received a binary stream shorter than the minimum header size.","commonSituations":"See trigger scenarios.","solutions":["Ensure the geometry value is a valid WKB/EWKB binary of at least five bytes.","Check that the column actually contains geometry data and was not truncated."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5ee1e990e73fbcae1969dc554be254fedb3ab888","analyzedAt":"2026-08-14T07:05:03.077Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}