{"record":{"id":"fc65e7a3629b6274","repo":"alibaba/spring-ai-alibaba","slug":"failed-to-create-store-key","errorCode":null,"errorMessage":"Failed to create store key","messagePattern":"Failed to create store key","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"spring-ai-alibaba-graph-core/src/main/java/com/alibaba/cloud/ai/graph/store/stores/BaseStore.java","lineNumber":129,"sourceCode":"\t\t}\n\t}\n\n\t/**\n\t * Create store key from namespace and key Uses safe encoding to avoid conflicts from\n\t * special characters.\n\t * @param namespace namespace\n\t * @param key key\n\t * @return store key\n\t */\n\tprotected String createStoreKey(List<String> namespace, String key) {\n\t\ttry {\n\t\t\tMap<String, Object> keyData = new HashMap<>();\n\t\t\tkeyData.put(\"namespace\", namespace);\n\t\t\tkeyData.put(\"key\", key);\n\t\t\treturn Base64.getEncoder().encodeToString(new ObjectMapper().writeValueAsBytes(keyData));\n\t\t}\n\t\tcatch (Exception e) {\n\t\t\tthrow new RuntimeException(\"Failed to create store key\", e);\n\t\t}\n\t}\n\n\t/**\n\t * Parse store key to namespace and key.\n\t * @param storeKey store key\n\t * @return array containing [namespace, key]\n\t */\n\t@SuppressWarnings(\"unchecked\")\n\tprotected Object[] parseStoreKey(String storeKey) {\n\t\ttry {\n\t\t\tbyte[] decoded = Base64.getDecoder().decode(storeKey);\n\t\t\tMap<String, Object> keyData = new ObjectMapper().readValue(decoded, Map.class);\n\t\t\tList<String> namespace = (List<String>) keyData.get(\"namespace\");\n\t\t\tString key = (String) keyData.get(\"key\");\n\t\t\treturn new Object[] { namespace, key };\n\t\t}\n\t\tcatch (Exception e) {","sourceCodeStart":111,"sourceCodeEnd":147,"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/BaseStore.java#L111-L147","documentation":"createStoreKey encodes {namespace, key} as JSON and Base64; if serialization fails for any reason it wraps the exception in RuntimeException(\"Failed to create store key\"). This is an internal encoding step, so failure usually indicates an unexpected problem (e.g. JSON serialization of the namespace/key data).","triggerScenarios":"Any getItem/putItem/deleteItem call where Base64 encoding of the JSON-serialized keyData throws — practically rare since inputs are List<String> and String, but possible via an ObjectMapper construction/serialization failure.","commonSituations":"Odd characters or extremely large namespaces triggering serializer limits; environments where a custom ObjectMapper/JSON provider conflicts; wrapped low-level IOException surfaced during store operations.","solutions":["Inspect the wrapped cause (e.getCause()) to find the real serialization failure.","Verify namespace and key contain normal strings without control characters; sanitize inputs.","Retry the operation if the cause is transient; otherwise report it as a library bug with the cause chain."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (namespace == null || key == null || key.isBlank()) {\n    throw new IllegalArgumentException(\"namespace and non-blank key required\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    store.getItem(namespace, key);\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Failed to create store key\")) {\n        throw new IllegalStateException(\"Store key encoding failed: \" + e.getCause(), e);\n    }\n    throw e;\n}","preventionTips":["Keep namespace/key as plain strings without control characters.","Always inspect getCause() when this wrapper is thrown.","Report persistent occurrences with the full cause chain as a library issue."],"tags":["java","json","internal-error","store"],"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-17T15:17:12.973Z"}