{"record":{"id":"940422f39bfec495","repo":"squidfunk/mkdocs-material","slug":"error-reading-metadata-k-of-post-path-in","errorCode":null,"errorMessage":"Error reading metadata '{k}' of post '{path}' in '{docs}':\n{e}","messagePattern":"Error reading metadata '(.+?)' of post '(.+?)' in '(.+?)':\n(.+?)","errorType":"exception","errorClass":"PluginError","httpStatus":null,"severity":"error","filePath":"src/plugins/blog/structure/__init__.py","lineNumber":119,"sourceCode":"                    self.markdown, page = self, config = config, files = None\n                )\n\n        # Initialize post configuration, but remove all keys that this plugin\n        # doesn't care about, or they will be reported as invalid configuration\n        self.config: PostConfig = PostConfig(file.abs_src_path)\n        self.config.load_dict({\n            key: self.meta[key] for key in (\n                set(self.meta.keys()) &\n                set(self.config.keys())\n            )\n        })\n\n        # Validate configuration and throw if errors occurred\n        errors, warnings = self.config.validate()\n        for _, w in warnings:\n            log.warning(w)\n        for k, e in errors:\n            raise PluginError(\n                f\"Error reading metadata '{k}' of post '{path}' in '{docs}':\\n\"\n                f\"{e}\"\n            )\n\n        # Excerpts are subsets of posts that are used in pages like archive and\n        # category views. They are not rendered as standalone pages, but are\n        # rendered in the context of a view. Each post has a dedicated excerpt\n        # instance which is reused when rendering views.\n        self.excerpt: Excerpt = None\n\n        # Initialize authors and actegories\n        self.authors: list[Author] = []\n        self.categories: list[Category] = []\n\n        # Ensure template is set or use default\n        self.meta.setdefault(\"template\", \"blog-post.html\")\n\n        # Ensure template hides navigation","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/squidfunk/mkdocs-material/blob/e2136532f40aed98af1f6497c0cc6a3cff9f759b/src/plugins/blog/structure/__init__.py#L101-L137","documentation":"After parsing the front-matter, the Post class validates its option schema via `self.config.validate()`. Each entry in the resulting errors list (option key plus error message) aborts the build with this PluginError, naming the specific metadata key that failed validation.","triggerScenarios":"A metadata key in a post's front-matter has a value of the wrong type or format, e.g. `date` not a valid date, `slug` not a string, unknown/invalid values for keys like `draft`, `readtime`, or `categories` of unexpected shape.","commonSituations":"Writing `date: January 5, 2024` instead of an ISO date; giving a list where a string is expected; misspelling an enum-like option value; schema changes after upgrading mkdocs-material.","solutions":["Fix the metadata key named in the message to match the expected type/format shown in the appended error","Use ISO 8601 dates (`date: 2024-01-15`) and correct value types","Check the blog plugin documentation for the valid option names and value types","If caused by an upgrade, review the changelog for changed post metadata schema"],"exampleFix":"# before\n---\ntitle: My Post\ndate: January 5, 2024\ncategories: Tutorials\n---\n\n// after\n---\ntitle: My Post\ndate: 2024-01-05\ncategories:\n  - Tutorials\n---","handlingStrategy":"validation","validationCode":"import yaml, datetime\nREQUIRED = {'title': str, 'date': (datetime.date, datetime.datetime)}\nfor p in Path('docs/posts').rglob('*.md'):\n    text = p.read_text(encoding='utf-8-sig')\n    meta = yaml.safe_load(text.split('---')[1])\n    for k, t in REQUIRED.items():\n        assert k in meta and isinstance(meta[k], t), f\"{p}: bad metadata '{k}'\"\n","typeGuard":"def has_valid_key(meta, key, expected_type):\n    return key in meta and isinstance(meta[key], expected_type)\n","tryCatchPattern":"try:\n    mkdocs.commands.build(config)\nexcept PluginError as e:\n    if \"Error reading metadata\" in str(e):\n        key = str(e).split(\"metadata '\")[1].split(\"'\")[0]\n        log.error(f\"Fix '{key}' in the post front matter: {e}\")\n    raise\n","preventionTips":["Follow the documented schema for post metadata exactly (types and option names)","Use ISO dates and lists where lists are expected","After upgrading mkdocs-material, re-check metadata keys against the changelog","Add a pre-commit hook that lints post front-matter"],"tags":["mkdocs","blog-plugin","config-validation","front-matter"],"backgroundTag":"schema-validation-failed","analyzedSha":"e2136532f40aed98af1f6497c0cc6a3cff9f759b","analyzedAt":"2026-08-29T11:20:04.299Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}