{"record":{"id":"2d55b7324f4d09f0","repo":"microsoft/graphrag","slug":"templateengineconfig-template-manager-strategy","errorCode":null,"errorMessage":"TemplateEngineConfig.template_manager '{strategy}' is not registered in the TemplateManagerFactory. Registered strategies: {', '.join(template_manager_factory.keys())}","messagePattern":"TemplateEngineConfig\\.template_manager '(.+?)' is not registered in the TemplateManagerFactory\\. Registered strategies: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-llm/graphrag_llm/templating/template_manager_factory.py","lineNumber":80,"sourceCode":"    template_engine_config = template_engine_config or TemplateEngineConfig()\n    strategy = template_engine_config.template_manager\n    init_args = template_engine_config.model_dump()\n\n    if strategy not in template_manager_factory:\n        match strategy:\n            case TemplateManagerType.File:\n                from graphrag_llm.templating.file_template_manager import (\n                    FileTemplateManager,\n                )\n\n                template_manager_factory.register(\n                    strategy=TemplateManagerType.File,\n                    initializer=FileTemplateManager,\n                    scope=\"singleton\",\n                )\n            case _:\n                msg = f\"TemplateEngineConfig.template_manager '{strategy}' is not registered in the TemplateManagerFactory. Registered strategies: {', '.join(template_manager_factory.keys())}\"\n                raise ValueError(msg)\n\n    return template_manager_factory.create(strategy=strategy, init_args=init_args)\n","sourceCodeStart":62,"sourceCodeEnd":83,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-llm/graphrag_llm/templating/template_manager_factory.py#L62-L83","documentation":"The template manager factory only registers a fixed set of strategies (File, and any others registered in create_template_manager's match statement). When TemplateEngineConfig.template_manager is set to a name not covered by a case, the wildcard branch raises ValueError listing the registered strategies.","triggerScenarios":"Calling create_template_engine (which calls create_template_manager) with a config whose template_manager string is misspelled, uses the wrong casing, or refers to a backend (e.g. 'db', 'http', 'database') that was never registered.","commonSituations":"Typos in YAML/env config (e.g. 'file ' with whitespace, 'File ' vs 'file'), upgrading graphrag-llm where a strategy was renamed or removed, or copy-pasting config from a different library version.","solutions":["Fix the template_manager value to exactly one of the strategies listed in the error message","Check the casing and whitespace of the value in your config file / environment variable","If you need a custom backend, register it in the TemplateManagerFactory before calling create_template_engine","Pin or align your graphrag-llm version with the docs/config schema you copied from"],"exampleFix":"# before\nconfig = TemplateEngineConfig(template_manager='db')\nengine = create_template_engine(config)\n\n# after\nconfig = TemplateEngineConfig(template_manager=TemplateManagerType.File)\nengine = create_template_engine(config)","handlingStrategy":"validation","validationCode":"from graphrag_llm.templating.template_manager_factory import template_manager_factory\nvalid = set(template_manager_factory.keys())\nassert config.template_manager in valid, f\"invalid template_manager {config.template_manager!r}, valid: {valid}\"","typeGuard":"def is_valid_template_manager(name: str) -> bool:\n    from graphrag_llm.templating.template_manager_factory import template_manager_factory\n    return name in template_manager_factory.keys()","tryCatchPattern":"try:\n    manager = create_template_manager(cfg)\nexcept ValueError as e:\n    # message lists registered strategies; surface as config error\n    raise ConfigError(str(e)) from e","preventionTips":["Use the enum members (TemplateManagerType.File) instead of raw strings","Validate config against factory.keys() at startup, not at first use"],"tags":["config","factory","template","graphrag"],"backgroundTag":"unknown-strategy-in-factory-registry","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}