{"record":{"id":"3981175390f45b1a","repo":"alibaba/spring-ai-alibaba","slug":"failed-to-dump-data-data","errorCode":null,"errorMessage":"failed to dump data${data}","messagePattern":"failed to dump data(.+?)","errorType":"exception","errorClass":"org.springframework.ai.mybatisplus.exception.SerializationException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/dsl/serialize/JsonSerializer.java","lineNumber":57,"sourceCode":"\t@Override\n\tpublic Map<String, Object> load(String s) {\n\t\ttry {\n\t\t\tMap<?, ?> value = objectMapper.readValue(s, Map.class);\n\t\t\treturn MapReadUtil.safeCastToMapWithStringKey(value);\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new RuntimeException(e);\n\t\t}\n\t}\n\n\t@Override\n\tpublic String dump(Map<String, Object> data) {\n\t\tString result;\n\t\ttry {\n\t\t\tresult = objectMapper.writeValueAsString(data);\n\t\t}\n\t\tcatch (JsonProcessingException e) {\n\t\t\tthrow new SerializationException(\"failed to dump data\" + data, e);\n\t\t}\n\t\treturn result;\n\t}\n\n}\n","sourceCodeStart":39,"sourceCodeEnd":63,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-admin/spring-ai-alibaba-admin-server-start/src/main/java/com/alibaba/cloud/ai/studio/admin/builder/generator/service/dsl/serialize/JsonSerializer.java#L39-L63","documentation":"Thrown by JsonSerializer.dump when Jackson's objectMapper.writeValueAsString throws JsonProcessingException while serializing the DSL data map to a JSON string. The original data is appended to the message (and the JsonProcessingException kept as cause) to aid diagnosis. In practice this occurs when the map contains non-serializable values such as cyclic references, Java objects without Jackson-compatible accessors, or invalid types inserted programmatically.","triggerScenarios":"dump() called on a data map containing objects Jackson cannot serialize (no getters, cycles, ObjectMapper-visible failures); JsonNode mixed with unserializable custom objects; data mutated after parse to include non-JSON types like Date without a configured serializer; infinite recursion via self-referencing structures.","commonSituations":"Saving an app after a converter inserted a live Java object instead of a JSON-compatible value; plugin/converter bugs leaking typed objects into the DSL map; ObjectMapper misconfiguration (e.g. failing on empty beans); large cyclic graphs of node data.","solutions":["Inspect the cause (JsonProcessingException) to identify the unserializable value and replace it with a JSON-compatible type (Map/List/String/Number)","Ensure any custom objects stored in the DSL map are Jackson-serializable (public getters or @JsonSerialize) or pre-converted via OBJECT_MAPPER.convertValue","Break cyclic references in the data structure before dumping","Configure the shared ObjectMapper (e.g. disable FAIL_ON_EMPTY_BEANS, register JavaTimeModule) if special types are expected"],"exampleFix":"// before\ndata.put(\"node\", new MyNodeObject()); // not Jackson-serializable\n\n// after\ndata.put(\"node\", objectMapper.convertValue(new MyNodeObject(), Map.class));","handlingStrategy":"try-catch","validationCode":"try {\n    OBJECT_MAPPER.writeValueAsString(data);\n} catch (JsonProcessingException e) {\n    throw new IllegalStateException(\"DSL data is not JSON-serializable: \" + e.getMessage());\n}","typeGuard":null,"tryCatchPattern":"try { String json = jsonSerializer.dump(data); } catch (SerializationException e) { log.error(\"Serialization failed for data; cause: {}, offending data: {}\", e.getCause(), e.getMessage(), e); throw e; }","preventionTips":["Store only JSON-compatible values (Map/List/String/Number/Boolean) in DSL maps","Convert custom objects with ObjectMapper.convertValue before inserting them","Avoid cyclic references in node data","Configure the shared ObjectMapper for special types (dates, optionals, empty beans)","Check the wrapped JsonProcessingException cause first when debugging"],"tags":["json","serialization","dsl"],"backgroundTag":"json-marshal-failed","analyzedSha":"f82da0b50f35744c13968191be2b1cd2452ef550","analyzedAt":"2026-09-09T15:32:42.421Z","contentChangedAt":"2026-09-09T15:32:42.421Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}