{"record":{"id":"fcebbf6e8d923d97","repo":"microsoft/graphrag","slug":"metricsconfig-writer-strategy-is-not-registere","errorCode":null,"errorMessage":"MetricsConfig.writer '{strategy}' is not registered in the MetricsWriterFactory. Registered strategies: {', '.join(metrics_writer_factory.keys())}","messagePattern":"MetricsConfig\\.writer '(.+?)' is not registered in the MetricsWriterFactory\\. Registered strategies: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-llm/graphrag_llm/metrics/metrics_writer_factory.py","lineNumber":89,"sourceCode":"            case MetricsWriterType.Log:\n                from graphrag_llm.metrics.log_metrics_writer import LogMetricsWriter\n\n                metrics_writer_factory.register(\n                    strategy=MetricsWriterType.Log,\n                    initializer=LogMetricsWriter,\n                    scope=\"singleton\",\n                )\n            case MetricsWriterType.File:\n                from graphrag_llm.metrics.file_metrics_writer import FileMetricsWriter\n\n                metrics_writer_factory.register(\n                    strategy=MetricsWriterType.File,\n                    initializer=FileMetricsWriter,\n                    scope=\"singleton\",\n                )\n            case _:\n                msg = f\"MetricsConfig.writer '{strategy}' is not registered in the MetricsWriterFactory. Registered strategies: {', '.join(metrics_writer_factory.keys())}\"\n                raise ValueError(msg)\n\n    return metrics_writer_factory.create(strategy=strategy, init_args=init_args)\n","sourceCodeStart":71,"sourceCodeEnd":92,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-llm/graphrag_llm/metrics/metrics_writer_factory.py#L71-L92","documentation":"This ValueError is raised by create_metrics_writer when MetricsConfig.writer holds a value that is not in the metrics_writer_factory registry. It is the catch-all branch of the match statement that lazily registers built-in writers (Log, File). Any other value falls through and the message enumerates registered strategies for easy correction.","triggerScenarios":"Calling create_metrics_store with a writer value that is misspelled, an unknown string, or a custom writer class name that was not registered via metrics_writer_factory.register(...).","commonSituations":"Typos in config files, enum renames between versions, or third-party writer integrations that forgot to call register.","solutions":["Set MetricsConfig.writer to one of the strategies listed in the error message","Fix typos/outdated values in YAML/JSON config","Register your custom writer with metrics_writer_factory.register(strategy=..., initializer=YourWriter, scope=...) before creation","Constrain the field to a Literal/enum in your own config layer to catch invalid values early"],"exampleFix":"# before\nconfig = MetricsConfig(store=\"memory\", writer=\"stdoutt\")\n\n# after\nconfig = MetricsConfig(store=\"memory\", writer=\"log\")","handlingStrategy":"validation","validationCode":"from graphrag_llm.metrics import metrics_writer_factory\n\nif metrics_config.writer not in metrics_writer_factory:\n    raise ValueError(f\"Invalid writer {metrics_config.writer!r}; valid: {list(metrics_writer_factory.keys())}\")","typeGuard":"from graphrag_llm.metrics import metrics_writer_factory\n\ndef is_valid_writer(name: str) -> bool:\n    return name in metrics_writer_factory","tryCatchPattern":"try:\n    writer = create_metrics_writer(cfg)\nexcept ValueError as e:\n    if \"not registered in the MetricsWriterFactory\" in str(e):\n        raise  # config bug: fix writer value\n    raise","preventionTips":["Validate writer against factory keys before creating the store","Use enum values from MetricsWriterType instead of raw strings","Register custom writers before first factory call"],"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"}