microsoft/graphrag · error · ValueError

MetricsConfig.processor '{strategy}' is not registered in th

Error message

MetricsConfig.processor '{strategy}' is not registered in the MetricsProcessorFactory. Registered strategies: {', '.join(metrics_processor_factory.keys())}

What it means

create_metrics_processor dispatches on MetricsConfig.processor against the registered processor factory; unknown values hit the catch-all case and raise with the registered strategy list. Reached indirectly via create_completion/create_embedding when a metrics config is supplied.

Source

Thrown at packages/graphrag-llm/graphrag_llm/metrics/metrics_processor_factory.py:71

    """
    strategy = metrics_config.type
    init_args = metrics_config.model_dump()

    if strategy not in metrics_processor_factory:
        match strategy:
            case MetricsProcessorType.Default:
                from graphrag_llm.metrics.default_metrics_processor import (
                    DefaultMetricsProcessor,
                )

                metrics_processor_factory.register(
                    strategy=MetricsProcessorType.Default,
                    initializer=DefaultMetricsProcessor,
                    scope="singleton",
                )
            case _:
                msg = f"MetricsConfig.processor '{strategy}' is not registered in the MetricsProcessorFactory. Registered strategies: {', '.join(metrics_processor_factory.keys())}"
                raise ValueError(msg)

    return metrics_processor_factory.create(
        strategy=strategy,
        init_args={
            **init_args,
            "metrics_config": metrics_config,
        },
    )

View on GitHub (pinned to f40e9a26ce)

Solutions

  1. Use a registered processor value (the error lists them), typically MetricsProcessorType.Default
  2. Register your custom processor first: register_metrics_processor(strategy=..., initializer=YourProcessor)
  3. Fix typos / re-check enum names after upgrading graphrag-llm

Example fix

# before
create_completion(model_config=cfg, metrics_config=MetricsConfig(processor="defualt"))
# after
create_completion(model_config=cfg, metrics_config=MetricsConfig(processor=MetricsProcessorType.Default))
Defensive patterns

Strategy: validation

Validate before calling

from graphrag_llm.metrics import MetricsProcessorType
if not isinstance(mc := (metrics_config.processor if metrics_config else None), (MetricsProcessorType,)) and str(mc) not in {e.value for e in MetricsProcessorType}:
    metrics_config = None  # or set processor=MetricsProcessorType.Default

Type guard

def is_registered_processor(p) -> bool:
    return p in {e.value for e in MetricsProcessorType} or p in list(MetricsProcessorType)

Try / catch

try:
    proc = create_metrics_processor(metrics_config=mc)
except ValueError as e:
    if "is not registered in the MetricsProcessorFactory" in str(e):
        mc.processor = MetricsProcessorType.Default
        proc = create_metrics_processor(metrics_config=mc)
    else:
        raise

Prevention

When it happens

Trigger: Calling create_completion or create_embedding with metrics_config.processor set to an unregistered name/enum; or constructing a metrics processor directly with an unknown strategy.

Common situations: Typo in the processor name in settings.yaml; a custom processor not yet registered via register_metrics_processor; version change renaming MetricsProcessorType members.

Related errors


AI-assisted analysis of microsoft/graphrag@f40e9a26ce (2026-08-27). Data as JSON: /api/errors/55159c0095b66e1c. Report an issue: GitHub.