microsoft/graphrag · error · ValueError
MetricsConfig.store '{strategy}' is not registered in the Me
Error message
MetricsConfig.store '{strategy}' is not registered in the MetricsStoreFactory. Registered strategies: {', '.join(metrics_store_factory.keys())} What it means
This ValueError is thrown by create_metrics_store when the MetricsConfig.store value does not match any strategy registered in the MetricsStoreFactory registry. It is the catch-all branch of a match statement, so any unrecognized store type string (or enum value) reaches it. The message lists all registered strategies so the caller can correct the config.
Source
Thrown at packages/graphrag-llm/graphrag_llm/metrics/metrics_store_factory.py:81
if config.writer:
from graphrag_llm.metrics.metrics_writer_factory import create_metrics_writer
metrics_writer = create_metrics_writer(config)
init_args: dict[str, Any] = config.model_dump()
if strategy not in metrics_store_factory:
match strategy:
case MetricsStoreType.Memory:
from graphrag_llm.metrics.memory_metrics_store import MemoryMetricsStore
register_metrics_store(
store_type=strategy,
store_initializer=MemoryMetricsStore,
scope="singleton",
)
case _:
msg = f"MetricsConfig.store '{strategy}' is not registered in the MetricsStoreFactory. Registered strategies: {', '.join(metrics_store_factory.keys())}"
raise ValueError(msg)
return metrics_store_factory.create(
strategy=strategy,
init_args={
**init_args,
"id": id,
"metrics_config": config,
"metrics_writer": metrics_writer,
},
)
View on GitHub (pinned to f40e9a26ce)
Solutions
- Check the error message's list of registered strategies and set MetricsConfig.store to one of them
- Fix typos or outdated enum values in your YAML/JSON config or MetricsConfig instance
- If you need a custom store, register it with metrics_store_factory.register(strategy=..., store_initializer=YourStore, scope=...) before calling create_completion/create_embedding
- Validate config at load time (pydantic Literal/enum) so invalid store values fail fast with a clear message
Example fix
# before config = MetricsConfig(store="mem") # after config = MetricsConfig(store="memory")
Defensive patterns
Strategy: validation
Validate before calling
from graphrag_llm.metrics import metrics_store_factory
strategy = metrics_config.store
if strategy not in metrics_store_factory:
raise ValueError(f"Invalid store {strategy!r}; valid: {list(metrics_store_factory.keys())}") Type guard
from graphrag_llm.metrics import metrics_store_factory
def is_valid_store(strategy: str) -> bool:
return strategy in metrics_store_factory Try / catch
try:
store = create_metrics_store(cfg)
except ValueError as e:
if "not registered in the MetricsStoreFactory" in str(e):
# log config error, correct MetricsConfig.store, or re-raise
raise
raise Prevention
- Validate strategy fields against factory keys at config load time
- Use pydantic enum/Literal types for store instead of free strings
- Register custom stores once at application startup
When it happens
Trigger: Calling create_completion or create_embedding with a metrics config whose store field is misspelled, a stale enum value, or a custom type that was never registered via metrics_store_factory.register(...). Also occurs when config is loaded from YAML/JSON with an unvalidated store key.
Common situations: Typos in config files ('memmory' vs 'memory'), upgrading graphrag-llm where store enum names changed, or using a plugin/custom MetricsStore without registering it first.
Related errors
- MetricsConfig.writer '{strategy}' is not registered in the M
- MetricsConfig.processor '{strategy}' is not registered in th
- MetricsConfig.writer needs to be set to create a MetricsWrit
- RateLimitConfig.type '{strategy}' is not registered in the R
- RetryConfig.type '{strategy}' is not registered in the Retry
AI-assisted analysis of microsoft/graphrag@f40e9a26ce (2026-08-27).
Data as JSON: /api/errors/8b26996cbf7217c9.
Report an issue: GitHub.