OtterMind/Chat2DB · error · IllegalArgumentException

EWKB bounding-box headers are not supported

Error message

EWKB bounding-box headers are not supported

What it means

Error "EWKB bounding-box headers are not supported" 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:179

    private WkbHeader inspectEwkb(byte[] ewkb) {
        // JTS repairs malformed rings and coordinate sequences, so validate the lossless subset first.
        WkbCursor cursor = new WkbCursor(ewkb);
        WkbHeader header = inspectGeometry(cursor, null, true, 0);
        if (!cursor.isExhausted()) {
            throw new IllegalArgumentException("EWKB contains trailing data");
        }
        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);

View on GitHub (pinned to 5ee1e990e7)

Solutions

  1. Strip the bounding-box flag from the EWKB (use standard PostGIS output without bbox) before import.

When it happens

Trigger: The EWKB value included bounding-box header data, which this parser does not support.

Common situations: See trigger scenarios.


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