run-llama/llama_index · error · ValueError
Invalid ChatStore name: {chat_store_name}
Error message
Invalid ChatStore name: {chat_store_name} What it means
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.
Source
Thrown at llama-index-core/llama_index/core/storage/chat_store/loading.py:16
from llama_index.core.storage.chat_store.base import BaseChatStore
from llama_index.core.storage.chat_store.simple_chat_store import SimpleChatStore
RECOGNIZED_CHAT_STORES = {
SimpleChatStore.class_name(): SimpleChatStore,
}
def load_chat_store(data: dict) -> BaseChatStore:
"""Load a chat store from a dict."""
chat_store_name = data.get("class_name")
if chat_store_name is None:
raise ValueError("ChatStore loading requires a class_name")
if chat_store_name not in RECOGNIZED_CHAT_STORES:
raise ValueError(f"Invalid ChatStore name: {chat_store_name}")
return RECOGNIZED_CHAT_STORES[chat_store_name].from_dict(data)
View on GitHub (pinned to afd0fef371)
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.
Example fix
# before store = load_chat_store(data) # data['class_name'] == 'MyChatStore' -> ValueError # after from llama_index.core.storage.chat_store.loading import RECOGNIZED_CHAT_STORES RECOGNIZED_CHAT_STORES['MyChatStore'] = MyChatStore # one-time registration store = load_chat_store(data)
Defensive patterns
Strategy: validation
Validate before calling
from llama_index.core.storage.chat_store.loading import RECOGNIZED_CHAT_STORES
def safe_load_chat_store(data: dict):
name = data.get('class_name')
if name not in RECOGNIZED_CHAT_STORES:
raise ValueError(f'Unsupported chat store {name!r}; known: {sorted(RECOGNIZED_CHAT_STORES)}')
return RECOGNIZED_CHAT_STORES[name].from_dict(data) Type guard
def is_recognized_chat_store_name(data) -> bool:
from llama_index.core.storage.chat_store.loading import RECOGNIZED_CHAT_STORES
return isinstance(data, dict) and data.get('class_name') in RECOGNIZED_CHAT_STORES Try / catch
try:
store = load_chat_store(data)
except ValueError as e:
if 'Invalid ChatStore name' in str(e):
store = SimpleChatStore() # fallback to default store
else:
raise Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- ChatStore loading requires a class_name
- Invalid LLM name: {llm_name}
- Failed to serialize additional_kwargs value: {value}
- First argument to Readability constructor should be a docume
- Command failed: {command} {result.stderr}
AI-assisted analysis of run-llama/llama_index@afd0fef371 (2026-08-15).
Data as JSON: /api/errors/16d165f17721d2b1.
Report an issue: GitHub.