{"record":{"id":"16d165f17721d2b1","repo":"run-llama/llama_index","slug":"invalid-chatstore-name-chat-store-name","errorCode":null,"errorMessage":"Invalid ChatStore name: {chat_store_name}","messagePattern":"Invalid ChatStore name: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/storage/chat_store/loading.py","lineNumber":16,"sourceCode":"from llama_index.core.storage.chat_store.base import BaseChatStore\nfrom llama_index.core.storage.chat_store.simple_chat_store import SimpleChatStore\n\nRECOGNIZED_CHAT_STORES = {\n    SimpleChatStore.class_name(): SimpleChatStore,\n}\n\n\ndef load_chat_store(data: dict) -> BaseChatStore:\n    \"\"\"Load a chat store from a dict.\"\"\"\n    chat_store_name = data.get(\"class_name\")\n    if chat_store_name is None:\n        raise ValueError(\"ChatStore loading requires a class_name\")\n\n    if chat_store_name not in RECOGNIZED_CHAT_STORES:\n        raise ValueError(f\"Invalid ChatStore name: {chat_store_name}\")\n\n    return RECOGNIZED_CHAT_STORES[chat_store_name].from_dict(data)\n","sourceCodeStart":1,"sourceCodeEnd":19,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/storage/chat_store/loading.py#L1-L19","documentation":"load_chat_store(data) looks up data['class_name'] in RECOGNIZED_CHAT_STORES, which currently contains only SimpleChatStore. Any other class_name string (e.g. 'RedisChatStore', a typo, or a custom store name) is rejected because the loader has no registry entry to reconstruct from.","triggerScenarios":"load_chat_store({'class_name': 'RedisChatStore', ...}), or any dict whose class_name is not the exact SimpleChatStore.class_name() string; also payloads produced by to_dict() of a store whose class was never registered in the loader.","commonSituations":"Serializing a custom or remote chat store and expecting load_chat_store to round-trip it; cross-version payloads where the registered name changed; team-shared session files created by a different deployment.","solutions":["Use SimpleChatStore for serializable persistence, or persist with SimpleChatStore.to_dict() so the class_name matches.","For custom stores, register them before loading: from llama_index.core.storage.chat_store.loading import RECOGNIZED_CHAT_STORES; RECOGNIZED_CHAT_STORES[MyStore.class_name()] = MyStore.","For Redis/Postgres stores, skip load_chat_store and construct the store with its native constructor/connection parameters.","Verify the exact class_name string in the payload against RECOGNIZED_CHAT_STORES keys before loading."],"exampleFix":"# before\nstore = load_chat_store(data)  # data['class_name'] == 'MyChatStore' -> ValueError\n\n# after\nfrom llama_index.core.storage.chat_store.loading import RECOGNIZED_CHAT_STORES\nRECOGNIZED_CHAT_STORES['MyChatStore'] = MyChatStore  # one-time registration\nstore = load_chat_store(data)","handlingStrategy":"validation","validationCode":"from llama_index.core.storage.chat_store.loading import RECOGNIZED_CHAT_STORES\n\ndef safe_load_chat_store(data: dict):\n    name = data.get('class_name')\n    if name not in RECOGNIZED_CHAT_STORES:\n        raise ValueError(f'Unsupported chat store {name!r}; known: {sorted(RECOGNIZED_CHAT_STORES)}')\n    return RECOGNIZED_CHAT_STORES[name].from_dict(data)","typeGuard":"def is_recognized_chat_store_name(data) -> bool:\n    from llama_index.core.storage.chat_store.loading import RECOGNIZED_CHAT_STORES\n    return isinstance(data, dict) and data.get('class_name') in RECOGNIZED_CHAT_STORES","tryCatchPattern":"try:\n    store = load_chat_store(data)\nexcept ValueError as e:\n    if 'Invalid ChatStore name' in str(e):\n        store = SimpleChatStore()  # fallback to default store\n    else:\n        raise","preventionTips":["Register custom chat store classes in RECOGNIZED_CHAT_STORES before loading their payloads.","Use SimpleChatStore for JSON-persisted sessions; construct Redis/SQL stores directly.","Pin the llama-index version that wrote the payloads so class_name strings stay compatible."],"tags":["chat-store","serialization","registry","persistence","llama-index"],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}