{"record":{"id":"11953f399ca08eaf","repo":"prestodb/presto","slug":"generic-internal-error-11953f","errorCode":"GENERIC_INTERNAL_ERROR","errorMessage":"Unhandled type for %s:%s","messagePattern":"Unhandled type for (.+?):(.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":500,"severity":"error","filePath":"presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSource.java","lineNumber":177,"sourceCode":"            else if (javaType == long.class) {\n                if (type.equals(BIGINT)) {\n                    type.writeLong(output, ((Number) value).longValue());\n                }\n                else if (type.equals(INTEGER)) {\n                    type.writeLong(output, ((Number) value).intValue());\n                }\n                else if (type.equals(DATE)) {\n                    long utcMillis = ((Date) value).getTime();\n                    type.writeLong(output, TimeUnit.MILLISECONDS.toDays(utcMillis));\n                }\n                else if (type.equals(TIME)) {\n                    type.writeLong(output, ZonedDateTime.ofInstant(((Date) value).toInstant(), UTC_ZONE_ID).get(ChronoField.MILLI_OF_DAY));\n                }\n                else if (type.equals(TIMESTAMP)) {\n                    type.writeLong(output, ((Date) value).getTime());\n                }\n                else {\n                    throw new PrestoException(GENERIC_INTERNAL_ERROR, \"Unhandled type for \" + javaType.getSimpleName() + \":\" + type.getTypeSignature());\n                }\n            }\n            else if (javaType == double.class) {\n                type.writeDouble(output, ((Number) value).doubleValue());\n            }\n            else if (javaType == Slice.class) {\n                writeSlice(output, type, value);\n            }\n            else if (javaType == Block.class) {\n                writeBlock(output, type, value);\n            }\n            else {\n                throw new PrestoException(GENERIC_INTERNAL_ERROR, \"Unhandled type for \" + javaType.getSimpleName() + \":\" + type.getTypeSignature());\n            }\n        }\n        catch (ClassCastException ignore) {\n            // returns null instead of raising exception\n            output.appendNull();","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSource.java#L159-L195","documentation":"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.","triggerScenarios":"Thrown at presto-mongodb/src/main/java/com/facebook/presto/mongodb/MongoPageSource.java:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Store values in the collection using types matching the table schema (e.g. numbers as numbers, not strings)","Recreate the collection or adjust the schema definition to the actual BSON types","Clean or cast the offending documents in MongoDB"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}