{"record":{"id":"a59897fabf9a89a0","repo":"alibaba/spring-ai-alibaba","slug":"failed-to-deserialize-store-item","errorCode":null,"errorMessage":"Failed to deserialize store item","messagePattern":"Failed to deserialize store item","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/store/stores/DatabaseStore.java","lineNumber":905,"sourceCode":"     */\n    @SuppressWarnings(\"unchecked\")\n    private StoreItem resultSetToStoreItem(ResultSet rs) {\n        try {\n            String namespaceJson = rs.getString(\"namespace\");\n            String key = rs.getString(\"key_name\");\n            String valueJson = rs.getString(\"value_json\");\n            Timestamp createdAt = rs.getTimestamp(\"created_at\");\n            Timestamp updatedAt = rs.getTimestamp(\"updated_at\");\n\n            objectMapper.findAndRegisterModules();\n            JavaType namespaceType = objectMapper.getTypeFactory().constructCollectionType(List.class, String.class);\n            JavaType valueType = objectMapper.getTypeFactory().constructMapType(Map.class, String.class, Object.class);\n            List<String> namespace = objectMapper.readValue(namespaceJson, namespaceType);\n            Map<String, Object> value = objectMapper.readValue(valueJson, valueType);\n\n            return new StoreItem(namespace, key, value, createdAt.getTime(), updatedAt.getTime());\n        } catch (Exception e) {\n            throw new RuntimeException(\"Failed to deserialize store item\", e);\n        }\n    }\n\n}\n","sourceCodeStart":887,"sourceCodeEnd":910,"githubUrl":"https://github.com/alibaba/spring-ai-alibaba/blob/f82da0b50f35744c13968191be2b1cd2452ef550/spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/store/stores/DatabaseStore.java#L887-L910","documentation":"resultSetToStoreItem() deserializes the namespace and value JSON columns via Jackson and constructs a StoreItem; any exception (JsonProcessingException, null timestamp, malformed row) is wrapped in this RuntimeException. It means a row in the table could not be converted back into a StoreItem.","triggerScenarios":"Reading a row whose value_json or namespace_json is corrupt, hand-edited, written by an incompatible schema version, or whose timestamp columns are NULL.","commonSituations":"Manual UPDATEs to the table; version upgrade changing StoreItem JSON shape; NULL created_at/updated_at inserted by external scripts; truncation of JSON by narrow columns.","solutions":["Find the offending row(s) by checking id/key in the chained cause or querying rows with invalid JSON.","Fix or delete the corrupt rows (they are otherwise skipped in bulk reads as 'invalid items').","Ensure timestamps columns are NOT NULL and populated.","Keep the table schema and StoreItem serialization version in sync across library upgrades; migrate old rows."],"exampleFix":"// before\nUPDATE store_table SET value_json = 'not json' WHERE id = 'x';\n// after\nUPDATE store_table SET value_json = '{\"valid\":\"json\"}' WHERE id = 'x';","handlingStrategy":"validation","validationCode":"// scan for corrupt rows before listing\n// SELECT id FROM store_table WHERE NOT JSON_VALID(value_json);  (MySQL)","typeGuard":null,"tryCatchPattern":"try { StoreItem i = store.getItem(ns, key); } catch (RuntimeException e) { if (e.getMessage().contains(\"deserialize\")) { log.error(\"corrupt row: {}\", e.getCause()); } throw e; }","preventionTips":["Never hand-edit store table contents directly","Add NOT NULL constraints on created_at/updated_at columns","Migrate JSON data when upgrading library versions","Use JSON_VALID checks in DB maintenance scripts"],"tags":["jackson","json","deserialization","database"],"backgroundTag":"json-unmarshal-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"}