OtterMind/Chat2DB · error · IllegalArgumentException

Nested EWKB SRID differs from its parent

Error message

Nested EWKB SRID differs from its parent

What it means

Error "Nested EWKB SRID differs from its parent" 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:194

        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++) {
                    inspectLinearRing(cursor, byteOrder, coordinateDimension);
                }
            }
            case 4 -> inspectChildren(cursor, byteOrder, header, inheritedSrid, 1, depth);
            case 5 -> inspectChildren(cursor, byteOrder, header, inheritedSrid, 2, depth);
            case 6 -> inspectChildren(cursor, byteOrder, header, inheritedSrid, 3, depth);
            case 7 -> inspectChildren(cursor, byteOrder, header, inheritedSrid, 0, depth);
            default -> throw new IllegalArgumentException("Unsupported EWKB geometry type");

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Ensure all nested geometries share the same SRID as the parent collection, or remove SRIDs from children.

When it happens

Trigger: A nested EWKB geometry declared a different SRID than its enclosing collection.

Common situations: See trigger scenarios.


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