{"record":{"id":"a990ce257cf2f276","repo":"OtterMind/Chat2DB","slug":"ewkb-nesting-is-too-deep","errorCode":null,"errorMessage":"EWKB nesting is too deep","messagePattern":"EWKB nesting is too deep","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"chat2db-community-server/chat2db-community-plugins/chat2db-community-postgresql/src/main/java/ai/chat2db/plugin/postgresql/value/sub/PostgreSQLGeometryProcessor.java","lineNumber":174,"sourceCode":"        if (candidate.length() < 10 || candidate.length() % 2 != 0 || !HEX_PATTERN.matcher(candidate).matches()) {\n            return null;\n        }\n        return candidate;\n    }\n\n    private WkbHeader inspectEwkb(byte[] ewkb) {\n        // JTS repairs malformed rings and coordinate sequences, so validate the lossless subset first.\n        WkbCursor cursor = new WkbCursor(ewkb);\n        WkbHeader header = inspectGeometry(cursor, null, true, 0);\n        if (!cursor.isExhausted()) {\n            throw new IllegalArgumentException(\"EWKB contains trailing data\");\n        }\n        return header;\n    }\n\n    private WkbHeader inspectGeometry(WkbCursor cursor, Integer inheritedSrid, boolean root, int depth) {\n        if (depth > MAX_NESTED_DEPTH) {\n            throw new IllegalArgumentException(\"EWKB nesting is too deep\");\n        }\n        ByteOrder byteOrder = readByteOrder(cursor);\n        int typeWord = cursor.readInt(byteOrder);\n        if ((typeWord & EWKB_BBOX_FLAG) != 0) {\n            throw new IllegalArgumentException(\"EWKB bounding-box headers are not supported\");\n        }\n\n        int isoType = typeWord & EWKB_TYPE_MASK;\n        int dimensionCode = isoType / 1000;\n        int baseType = isoType % 1000;\n        if (dimensionCode > 3 || baseType < 1 || baseType > 7) {\n            throw new IllegalArgumentException(\"Unsupported EWKB geometry type\");\n        }\n\n        boolean hasZ = (typeWord & EWKB_Z_FLAG) != 0 || dimensionCode == 1 || dimensionCode == 3;\n        boolean hasMeasure = (typeWord & EWKB_M_FLAG) != 0 || dimensionCode == 2 || dimensionCode == 3;\n        boolean hasSrid = (typeWord & EWKB_SRID_FLAG) != 0;\n        Integer srid = hasSrid ? cursor.readInt(byteOrder) : null;","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/OtterMind/Chat2DB/blob/5ee1e990e73fbcae1969dc554be254fedb3ab888/chat2db-community-server/chat2db-community-plugins/chat2db-community-postgresql/src/main/java/ai/chat2db/plugin/postgresql/value/sub/PostgreSQLGeometryProcessor.java#L156-L192","documentation":"Error \"EWKB nesting is too deep\" thrown in OtterMind/Chat2DB.","triggerScenarios":"An EWKB geometry collection was nested deeper than the parser's limit.","commonSituations":"See trigger scenarios.","solutions":["Reduce the nesting depth of the geometry collection, or flatten the geometry before storing."],"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"}