{"record":{"id":"659f79d7b0cf9d79","repo":"microsoft/graphrag","slug":"template-extension-cannot-be-an-empty-string-for-f","errorCode":null,"errorMessage":"template_extension cannot be an empty string for file-based template managers.","messagePattern":"template_extension cannot be an empty string for file-based template managers\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/graphrag-llm/graphrag_llm/config/template_engine_config.py","lineNumber":56,"sourceCode":"    )\n\n    encoding: str | None = Field(\n        default=None,\n        description=\"The file encoding for reading templates in file-based template managers.\",\n    )\n\n    def _validate_file_template_manager_config(self) -> None:\n        \"\"\"Validate parameters for file-based template managers.\"\"\"\n        if self.base_dir is not None and self.base_dir.strip() == \"\":\n            msg = \"base_dir must be specified for file-based template managers.\"\n            raise ValueError(msg)\n\n        if (\n            self.template_extension is not None\n            and self.template_extension.strip() == \"\"\n        ):\n            msg = \"template_extension cannot be an empty string for file-based template managers.\"\n            raise ValueError(msg)\n\n        if (\n            self.template_extension is not None\n            and not self.template_extension.startswith(\".\")\n        ):\n            self.template_extension = f\".{self.template_extension}\"\n\n    @model_validator(mode=\"after\")\n    def _validate_model(self):\n        \"\"\"Validate the template engine configuration based on its type.\"\"\"\n        if self.template_manager == TemplateManagerType.File:\n            self._validate_file_template_manager_config()\n        return self\n","sourceCodeStart":38,"sourceCodeEnd":70,"githubUrl":"https://github.com/microsoft/graphrag/blob/f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704/packages/graphrag-llm/graphrag_llm/config/template_engine_config.py#L38-L70","documentation":"TemplateEngineConfig validation rejects template_extension values that are set but blank (empty or whitespace-only) for file-based template managers, since the manager could not match any template files.","triggerScenarios":"TemplateEngineConfig(template_extension=\"\" or \"   \") with a file-based manager type in settings.yaml.","commonSituations":"YAML key present with empty value; templated config rendering to blank; attempting to disable the extension filter by passing an empty string.","solutions":["Set template_extension to a real extension such as \".j2\" or \"txt\" (a leading dot is auto-added)","If you want no extension filter, omit template_extension entirely (leave it None)"],"exampleFix":"# before\nTemplateEngineConfig(type=<file manager>, base_dir=\"prompts\", template_extension=\"\")\n# after\nTemplateEngineConfig(type=<file manager>, base_dir=\"prompts\", template_extension=\".j2\")","handlingStrategy":"validation","validationCode":"ext = tmpl_cfg.get(\"template_extension\")\nif ext is not None and not ext.strip():\n    tmpl_cfg.pop(\"template_extension\")  # or fail loudly","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Omit template_extension when you want no filter","Standardize on one extension (e.g. .j2) in project conventions"],"tags":["templates","config-validation","file-extension"],"backgroundTag":"invalid-config-value","analyzedSha":"f40e9a26ce62ba0b3fef8837d24aafdcc6e6c704","analyzedAt":"2026-08-27T11:16:29.677Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}