{"record":{"id":"5d85ce0744733b33","repo":"alibaba/nacos","slug":"101-5d85ce","errorCode":"101","errorMessage":"Nacos deserialize for class [%s] failed, cause error[%s]. ","messagePattern":"Nacos deserialize for class \\[(.+?)\\] failed, cause error\\[(.+?)\\]\\. ","errorType":"error_code","errorClass":"NacosDeserializationException","httpStatus":null,"severity":"error","filePath":"common/src/main/java/com/alibaba/nacos/common/json/Jackson3JsonAdapterDelegate.java","lineNumber":149,"sourceCode":"    \n    private JavaType constructJavaType(Type type) {\n        return mapper.constructType(type);\n    }\n    \n    private <T> T write(Object obj, JsonWriter<T> writer) {\n        try {\n            return writer.write();\n        } catch (JacksonException e) {\n            Class<?> serializedClass = obj == null ? Object.class : obj.getClass();\n            throw new NacosSerializationException(serializedClass, e);\n        }\n    }\n    \n    private <T> T read(JsonReader<T> reader, Class<?> cls) {\n        try {\n            return reader.read();\n        } catch (JacksonException e) {\n            throw new NacosDeserializationException(cls, e);\n        }\n    }\n    \n    private <T> T read(JsonReader<T> reader, Type type) {\n        try {\n            return reader.read();\n        } catch (JacksonException e) {\n            throw new NacosDeserializationException(type, e);\n        }\n    }\n    \n    private static ObjectMapper createObjectMapper(Collection<NacosJsonSubtype> subtypes) {\n        JsonMapper.Builder builder = JsonMapper.builderWithJackson2Defaults();\n        builder.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);\n        builder.changeDefaultPropertyInclusion(new NonNullPropertyInclusion());\n        registerSubtypes(builder, subtypes);\n        return builder.build();\n    }","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/common/src/main/java/com/alibaba/nacos/common/json/Jackson3JsonAdapterDelegate.java#L131-L167","documentation":"Thrown by Jackson3JsonAdapterDelegate.read(JsonReader, Class) when Jackson 3 fails to deserialize JSON into the target class. Wrapped as NacosDeserializationException (code 101) naming the class and the cause error. The Jackson 3 counterpart of error 744, catching JacksonException instead of broad Exception.","triggerScenarios":"Using the JACKSON3 adapter and calling fromJson(json, MyClass.class) on a payload that mismatches MyClass: wrong token types, missing creator, unrecognized polymorphic type, or JSON that is an error page rather than the expected DTO.","commonSituations":"Migrated to Jackson 3 which is stricter about constructors and coercion; server error envelope deserialized as a success DTO; field renamed across API versions; abstract target without @JsonTypeInfo under Jackson 3.","solutions":["Inspect e.getCause() (a Jackson 3 JacksonException subtype) for the exact path and reason.","Add/fix a @JsonCreator constructor or default constructor on the target class.","Log and compare the raw payload against the class to find the offending field.","For polymorphic types, supply @JsonTypeInfo/@JsonSubTypes or register a NacosJsonSubtype on the delegate.","If the payload is an error body, branch on HTTP status before deserializing to the success type."],"exampleFix":"// before\nResult r = jsonAdapter.fromJson(body, Result.class); // code 101 under Jackson 3\n\n// after\ntry {\n    return jsonAdapter.fromJson(body, Result.class);\n} catch (NacosDeserializationException e) {\n    log.error(\"Jackson3 failed on Result: cause={}\", e.getCause().getMessage());\n    throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (StringUtils.isBlank(json)) {\n    throw new IllegalArgumentException(\"empty JSON for \" + targetClass.getName());\n}","typeGuard":null,"tryCatchPattern":"try {\n    return jsonAdapter.fromJson(json, targetClass);\n} catch (NacosDeserializationException e) {\n    log.error(\"Jackson3 deserialize {} failed: {}\", targetClass.getName(),\n        e.getCause() != null ? e.getCause().getMessage() : e.getMessage());\n    throw e;\n}","preventionTips":["Jackson 3 is stricter on constructors — add @JsonCreator or a default constructor.","Branch on response status before deserializing to a success type.","Log raw payloads in a repro to compare against the target class."],"tags":["deserialization","jackson3","json","runtime"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}