{"record":{"id":"c82e7ddbbdffa66b","repo":"prestodb/presto","slug":"unexpected-type-found-s","errorCode":null,"errorMessage":"Unexpected type found: %s","messagePattern":"Unexpected type found: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"presto-client/src/main/java/com/facebook/presto/client/FixJsonDataUtils.java","lineNumber":121,"sourceCode":"            return fixValue(signature.getDistinctTypeInfo().getBaseType(), value);\n        }\n        if (signature.getTypeSignatureBase().hasTypeName() && signature.getTypeSignatureBase().hasStandardType()) {\n            return fixValue(signature.getStandardTypeSignature(), value);\n        }\n        if (signature.getBase().equals(ARRAY)) {\n            if (List.class.isAssignableFrom(value.getClass())) {\n                List<Object> fixedValue = new ArrayList<>();\n                for (Object object : List.class.cast(value)) {\n                    fixedValue.add(fixValue(signature.getTypeOrNamedTypeParametersAsTypeSignatures().get(0), object));\n                }\n                return fixedValue;\n            }\n            // JSON keys may be serialized and deserialized as simple strings\n            else if (value.getClass() == String.class) {\n                List<String> newValue = LIST_JSON_CODEC.fromJson(value.toString());\n                return fixValue(signature, newValue);\n            }\n            throw new IllegalArgumentException(String.format(\"Unexpected type found: %s\", value.getClass()));\n        }\n        if (signature.getBase().equals(MAP)) {\n            if (Map.class.isAssignableFrom(value.getClass())) {\n                TypeSignature keySignature = signature.getTypeOrNamedTypeParametersAsTypeSignatures().get(0);\n                TypeSignature valueSignature = signature.getTypeOrNamedTypeParametersAsTypeSignatures().get(1);\n                Map<Object, Object> fixedValue = new HashMap<>();\n                for (Map.Entry<?, ?> entry : (Set<Map.Entry<?, ?>>) Map.class.cast(value).entrySet()) {\n                    fixedValue.put(fixValue(keySignature, entry.getKey()), fixValue(valueSignature, entry.getValue()));\n                }\n                return fixedValue;\n            }\n            // JSON keys may be serialized and deserialized as simple strings\n            else if (value.getClass() == String.class) {\n                Map<String, String> newValue = MAP_JSON_CODEC.fromJson(value.toString());\n                return fixValue(signature, newValue);\n            }\n            throw new IllegalArgumentException(String.format(\"Unexpected type found: %s\", value.getClass()));\n        }","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-client/src/main/java/com/facebook/presto/client/FixJsonDataUtils.java#L103-L139","documentation":"Recursive value fixer in the client hit a value whose shape does not match any known signature branch (not ARRAY, MAP, ROW, or a recognized scalar), so it cannot normalize the JSON value to the declared type.","triggerScenarios":"Thrown at presto-client/src/main/java/com/facebook/presto/client/FixJsonDataUtils.java:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the query result type signature and the returned data agree","Upgrade client and server to matching versions so new type signatures are recognized","Simplify the query to avoid the exotic type if client upgrade is impossible"],"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"}