{"record":{"id":"f6054df09cdc08c6","repo":"FasterXML/jackson-databind","slug":"only-support-javatype-implementation-of-resolve","errorCode":null,"errorMessage":"Only support `JavaType` implementation of `ResolvedType`, not: {}","messagePattern":"Only support `JavaType` implementation of `ResolvedType`, not: (.+?)","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/DeserializationContext.java","lineNumber":393,"sourceCode":"     * rather use {@link #readPropertyValue(JsonParser, BeanProperty, Class)};\n     * this method does not allow use of contextual annotations.\n     */\n    @Override\n    public <T> T readValue(JsonParser p, Class<T> type) throws JacksonException {\n        return readValue(p, getTypeFactory().constructType(type));\n    }\n\n    @Override\n    public <T> T readValue(JsonParser p, TypeReference<T> refType) throws JacksonException {\n        return readValue(p, getTypeFactory().constructType(refType));\n    }\n\n    @Override\n    public <T> T readValue(JsonParser p, ResolvedType type) throws JacksonException {\n        if (type instanceof JavaType jt) {\n            return readValue(p, jt);\n        }\n        throw new UnsupportedOperationException(\n                \"Only support `JavaType` implementation of `ResolvedType`, not: \"+type.getClass().getName());\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public <T> T readValue(JsonParser p, JavaType type) throws JacksonException {\n        ValueDeserializer<Object> deser = findRootValueDeserializer(type);\n        if (deser == null) {\n            reportBadDefinition(type,\n                    \"Could not find `ValueDeserializer` for type \"+ClassUtil.getTypeDescription(type));\n        }\n        return (T) _readValue(p, deser);\n    }\n\n    /**\n     * Helper method that should handle special cases for deserialization; most\n     * notably handling {@code null} (and possibly absent values).\n     */\n    private Object _readValue(JsonParser p, ValueDeserializer<Object> deser) throws JacksonException","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/87876ca5c0569b4933aec2d30d6225e4b9ba3a43/src/main/java/tools/jackson/databind/DeserializationContext.java#L375-L411","documentation":"Thrown by DeserializationContext.readValue(JsonParser, ResolvedType) when the ResolvedType argument is not an instance of JavaType. Jackson's databind module only accepts its own JavaType implementation of the jackson-core ResolvedType interface. Other ResolvedType implementations (e.g., from a different Jackson major version or a third-party type system) are rejected.","triggerScenarios":"Calling ctxt.readValue(parser, someResolvedType) where someResolvedType comes from a non-Jackson source or a different Jackson version. Also possible when a custom extension of the streaming API provides its own ResolvedType that is not a JavaType.","commonSituations":"Mixing Jackson 2.x and 3.x jars on the classpath, causing a com.fasterxml.jackson.core.type.ResolvedType (2.x) to be passed where tools.jackson.core.type.ResolvedType (3.x) JavaType is expected. Using a custom type library that implements ResolvedType independently.","solutions":["Pass a JavaType instead of a raw ResolvedType: use ctxt.readValue(parser, ctxt.constructType(yourClass)) or TypeFactory.constructType().","Check for Jackson version conflicts on the classpath: run mvn dependency:tree and ensure only one major Jackson version is present.","If you have a TypeReference, use the readValue(parser, TypeReference) overload instead."],"exampleFix":"// before\nResolvedType type = myExternalTypeSystem.resolve(MyClass.class);\nctxt.readValue(parser, type); // throws\n// after\nJavaType type = ctxt.getTypeFactory().constructType(MyClass.class);\nctxt.readValue(parser, type);","handlingStrategy":"type-guard","validationCode":"// Ensure you pass JavaType, not a generic ResolvedType\nif (!(type instanceof JavaType)) {\n    type = mapper.constructType(type.getTypeReference()); // or rebuild\n}","typeGuard":"boolean isJavaType(ResolvedType type) {\n    return type instanceof JavaType;\n}","tryCatchPattern":null,"preventionTips":["Always use TypeFactory.constructType() to build the type argument.","Run mvn dependency:tree to detect Jackson version conflicts.","Prefer the readValue(parser, JavaType) or readValue(parser, Class<T>) overloads."],"tags":["type-system","deserialization","version-conflict","javatype"],"backgroundTag":null,"analyzedSha":"87876ca5c0569b4933aec2d30d6225e4b9ba3a43","analyzedAt":"2026-08-11T12:55:24.033Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}