OtterMind/Chat2DB · error · IllegalArgumentException

Unsupported EWKB geometry type

Error message

Unsupported EWKB geometry type

What it means

Error "Unsupported EWKB geometry type" thrown in OtterMind/Chat2DB.

Source

Thrown at chat2db-community-server/chat2db-community-plugins/chat2db-community-postgresql/src/main/java/ai/chat2db/plugin/postgresql/value/sub/PostgreSQLGeometryProcessor.java:186

        }
        return header;
    }

    private WkbHeader inspectGeometry(WkbCursor cursor, Integer inheritedSrid, boolean root, int depth) {
        if (depth > MAX_NESTED_DEPTH) {
            throw new IllegalArgumentException("EWKB nesting is too deep");
        }
        ByteOrder byteOrder = readByteOrder(cursor);
        int typeWord = cursor.readInt(byteOrder);
        if ((typeWord & EWKB_BBOX_FLAG) != 0) {
            throw new IllegalArgumentException("EWKB bounding-box headers are not supported");
        }

        int isoType = typeWord & EWKB_TYPE_MASK;
        int dimensionCode = isoType / 1000;
        int baseType = isoType % 1000;
        if (dimensionCode > 3 || baseType < 1 || baseType > 7) {
            throw new IllegalArgumentException("Unsupported EWKB geometry type");
        }

        boolean hasZ = (typeWord & EWKB_Z_FLAG) != 0 || dimensionCode == 1 || dimensionCode == 3;
        boolean hasMeasure = (typeWord & EWKB_M_FLAG) != 0 || dimensionCode == 2 || dimensionCode == 3;
        boolean hasSrid = (typeWord & EWKB_SRID_FLAG) != 0;
        Integer srid = hasSrid ? cursor.readInt(byteOrder) : null;
        if (!root && srid != null && !srid.equals(inheritedSrid)) {
            throw new IllegalArgumentException("Nested EWKB SRID differs from its parent");
        }

        WkbHeader header = new WkbHeader(baseType, hasZ, hasMeasure, srid);
        int coordinateDimension = 2 + (hasZ ? 1 : 0) + (hasMeasure ? 1 : 0);
        switch (baseType) {
            case 1 -> inspectPoint(cursor, byteOrder, coordinateDimension);
            case 2 -> inspectLineString(cursor, byteOrder, coordinateDimension);
            case 3 -> {
                int ringCount = readCount(cursor, byteOrder);
                for (int i = 0; i < ringCount; i++) {

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Convert the geometry to a supported EWKB geometry type (point, linestring, polygon, or standard collections).

When it happens

Trigger: The EWKB geometry type code was not one the parser recognizes.

Common situations: See trigger scenarios.


AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14). Data as JSON: /api/errors/b71c5840c3a87384. Report an issue: GitHub.