{"record":{"id":"e1824be4ebcb0cf2","repo":"microsoft/graphrag","slug":"modelconfig-type-strategy-is-not-registered-in-e1824b","errorCode":null,"errorMessage":"ModelConfig.type '{strategy}' is not registered in the CompletionFactory. Registered strategies: {', '.join(embedding_factory.keys())}","messagePattern":"ModelConfig\\.type '(.+?)' is not registered in the CompletionFactory\\. Registered strategies: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-llm/graphrag_llm/embedding/embedding_factory.py","lineNumber":106,"sourceCode":"                from graphrag_llm.embedding.lite_llm_embedding import (\n                    LiteLLMEmbedding,\n                )\n\n                register_embedding(\n                    embedding_type=LLMProviderType.LiteLLM,\n                    embedding_initializer=LiteLLMEmbedding,\n                    scope=\"singleton\",\n                )\n            case LLMProviderType.MockLLM:\n                from graphrag_llm.embedding.mock_llm_embedding import MockLLMEmbedding\n\n                register_embedding(\n                    embedding_type=LLMProviderType.MockLLM,\n                    embedding_initializer=MockLLMEmbedding,\n                )\n            case _:\n                msg = f\"ModelConfig.type '{strategy}' is not registered in the CompletionFactory. Registered strategies: {', '.join(embedding_factory.keys())}\"\n                raise ValueError(msg)\n\n    tokenizer = tokenizer or create_tokenizer(TokenizerConfig(model_id=model_id))\n\n    rate_limiter: RateLimiter | None = None\n    if model_config.rate_limit:\n        from graphrag_llm.rate_limit.rate_limit_factory import create_rate_limiter\n\n        rate_limiter = create_rate_limiter(rate_limit_config=model_config.rate_limit)\n\n    retrier: Retry | None = None\n    if model_config.retry:\n        from graphrag_llm.retry.retry_factory import create_retry\n\n        retrier = create_retry(retry_config=model_config.retry)\n\n    metrics_store: MetricsStore = NoopMetricsStore()\n    metrics_processor: MetricsProcessor | None = None\n    if model_config.metrics:","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-llm/graphrag_llm/embedding/embedding_factory.py#L88-L124","documentation":"create_embedding dispatches on ModelConfig.type against the registered embedding factory; an unregistered type hits the catch-all case and raises with the list of registered strategies. Note the message text mentions CompletionFactory even though this is the embedding factory (cosmetic bug in the message).","triggerScenarios":"Calling create_embedding(model_config) where model_config.type is not one of the registered embedding types (e.g. a completion-only provider type, a typo, or a new provider not registered via register_embedding).","commonSituations":"Passing a completion ModelConfig to create_embedding; upgrading graphrag-llm where a provider key/enum changed; custom embedding registered under a different LLMProviderType than the config uses.","solutions":["Check the error's 'Registered strategies' list and set model_config.type to one of those values (e.g. LLMProviderType.LiteLLM or the mock type for tests)","If you have a custom embedding, register it first with register_embedding(embedding_type=<your type>, embedding_initializer=YourClass) before calling create_embedding","If you meant to create a chat completion client, call create_completion instead of create_embedding"],"exampleFix":"# before\ncreate_embedding(model_config=ModelConfig(type=LLMProviderType.OpenAI, ...))\n# after\ncreate_embedding(model_config=ModelConfig(type=LLMProviderType.LiteLLM, model=\"text-embedding-3-small\", ...))","handlingStrategy":"try-catch","validationCode":"from graphrag_llm.embedding.embedding_factory import embedding_factory\n# (or parse the registered-strategies list from the error)\nif model_config.type not in KNOWN_EMBEDDING_TYPES:  # e.g. {LLMProviderType.LiteLLM, LLMProviderType.MockLLM}\n    raise ValueError(f\"{model_config.type} has no embedding backend\")","typeGuard":"def is_valid_embedding_type(t: LLMProviderType) -> bool:\n    return t in {LLMProviderType.LiteLLM, LLMProviderType.MockLLM}","tryCatchPattern":"try:\n    embedder = create_embedding(model_config=cfg)\nexcept ValueError as e:\n    if \"is not registered in the\" in str(e):\n        cfg.type = LLMProviderType.LiteLLM\n        embedder = create_embedding(model_config=cfg)\n    else:\n        raise","preventionTips":["Keep a set of valid embedding types in your config layer and assert before factory calls","Register custom embeddings once at import time in a bootstrap module","Don't reuse completion ModelConfig objects for embedding calls"],"tags":["factory","embedding","unknown-provider","config-validation"],"backgroundTag":"unknown-strategy-key","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}