{"record":{"id":"8b26996cbf7217c9","repo":"microsoft/graphrag","slug":"metricsconfig-store-strategy-is-not-registered","errorCode":null,"errorMessage":"MetricsConfig.store '{strategy}' is not registered in the MetricsStoreFactory. Registered strategies: {', '.join(metrics_store_factory.keys())}","messagePattern":"MetricsConfig\\.store '(.+?)' is not registered in the MetricsStoreFactory\\. Registered strategies: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-llm/graphrag_llm/metrics/metrics_store_factory.py","lineNumber":81,"sourceCode":"    if config.writer:\n        from graphrag_llm.metrics.metrics_writer_factory import create_metrics_writer\n\n        metrics_writer = create_metrics_writer(config)\n    init_args: dict[str, Any] = config.model_dump()\n\n    if strategy not in metrics_store_factory:\n        match strategy:\n            case MetricsStoreType.Memory:\n                from graphrag_llm.metrics.memory_metrics_store import MemoryMetricsStore\n\n                register_metrics_store(\n                    store_type=strategy,\n                    store_initializer=MemoryMetricsStore,\n                    scope=\"singleton\",\n                )\n            case _:\n                msg = f\"MetricsConfig.store '{strategy}' is not registered in the MetricsStoreFactory. Registered strategies: {', '.join(metrics_store_factory.keys())}\"\n                raise ValueError(msg)\n\n    return metrics_store_factory.create(\n        strategy=strategy,\n        init_args={\n            **init_args,\n            \"id\": id,\n            \"metrics_config\": config,\n            \"metrics_writer\": metrics_writer,\n        },\n    )\n","sourceCodeStart":63,"sourceCodeEnd":92,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-llm/graphrag_llm/metrics/metrics_store_factory.py#L63-L92","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nconfig = MetricsConfig(store=\"mem\")\n\n# after\nconfig = MetricsConfig(store=\"memory\")","handlingStrategy":"validation","validationCode":"from graphrag_llm.metrics import metrics_store_factory\n\nstrategy = metrics_config.store\nif strategy not in metrics_store_factory:\n    raise ValueError(f\"Invalid store {strategy!r}; valid: {list(metrics_store_factory.keys())}\")","typeGuard":"from graphrag_llm.metrics import metrics_store_factory\n\ndef is_valid_store(strategy: str) -> bool:\n    return strategy in metrics_store_factory","tryCatchPattern":"try:\n    store = create_metrics_store(cfg)\nexcept ValueError as e:\n    if \"not registered in the MetricsStoreFactory\" in str(e):\n        # log config error, correct MetricsConfig.store, or re-raise\n        raise\n    raise","preventionTips":["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"],"tags":["graphrag-llm","metrics","factory","config-validation"],"backgroundTag":"unknown-strategy-in-factory-registry","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}