prestodb/presto · error · PrestoException

GENERIC_INTERNAL_ERROR

GENERIC_INTERNAL_ERROR

Error message

Unhandled type for %s:%s

What it means

MongoDB read-side guard in MongoPageSource.appendTo: a value read from MongoDB has a Java type that does not match any of the branches handling the column's Presto type (unhandled Java-class/type combination). The %s pair names the column and Presto type; the stored BSON value's shape is the culprit.

Source

Thrown at presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSource.java:177

            else if (javaType == long.class) {
                if (type.equals(BIGINT)) {
                    type.writeLong(output, ((Number) value).longValue());
                }
                else if (type.equals(INTEGER)) {
                    type.writeLong(output, ((Number) value).intValue());
                }
                else if (type.equals(DATE)) {
                    long utcMillis = ((Date) value).getTime();
                    type.writeLong(output, TimeUnit.MILLISECONDS.toDays(utcMillis));
                }
                else if (type.equals(TIME)) {
                    type.writeLong(output, ZonedDateTime.ofInstant(((Date) value).toInstant(), UTC_ZONE_ID).get(ChronoField.MILLI_OF_DAY));
                }
                else if (type.equals(TIMESTAMP)) {
                    type.writeLong(output, ((Date) value).getTime());
                }
                else {
                    throw new PrestoException(GENERIC_INTERNAL_ERROR, "Unhandled type for " + javaType.getSimpleName() + ":" + type.getTypeSignature());
                }
            }
            else if (javaType == double.class) {
                type.writeDouble(output, ((Number) value).doubleValue());
            }
            else if (javaType == Slice.class) {
                writeSlice(output, type, value);
            }
            else if (javaType == Block.class) {
                writeBlock(output, type, value);
            }
            else {
                throw new PrestoException(GENERIC_INTERNAL_ERROR, "Unhandled type for " + javaType.getSimpleName() + ":" + type.getTypeSignature());
            }
        }
        catch (ClassCastException ignore) {
            // returns null instead of raising exception
            output.appendNull();

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Store values in the collection using types matching the table schema (e.g. numbers as numbers, not strings)
  2. Recreate the collection or adjust the schema definition to the actual BSON types
  3. Clean or cast the offending documents in MongoDB
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSource.java:177 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/11953f399ca08eaf. Report an issue: GitHub.