{"record":{"id":"3380d0d1565c64d9","repo":"agentscope-ai/agentscope","slug":"the-table-format-must-be-one-of-markdown-or-jso-3380d0","errorCode":null,"errorMessage":"The table_format must be one of 'markdown' or 'json', got {table_format!r}.","messagePattern":"The table_format must be one of 'markdown' or 'json', got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/agentscope/rag/_parser/_word.py","lineNumber":228,"sourceCode":"                :class:`DataBlock` sections.  Set to ``False`` to keep\n                a text-only index.\n            separate_table (`bool`, defaults to ``False``):\n                When ``True``, each table becomes its own text section,\n                never merged with surrounding paragraphs.\n            table_format (`Literal[\"markdown\", \"json\"]`, defaults to\n                ``\"markdown\"``):\n                How to render tables.  ``\"markdown\"`` uses pipe-table\n                syntax, escaping pipes and rendering cell line breaks\n                as ``<br>``; ``\"json\"`` emits a JSON array prefixed with\n                a ``<system-info>`` marker and preserves extracted cell\n                strings without Markdown rendering.\n\n        Raises:\n            `ValueError`: If ``table_format`` is not one of\n                ``\"markdown\"`` / ``\"json\"``.\n        \"\"\"\n        if table_format not in (\"markdown\", \"json\"):\n            raise ValueError(\n                \"The table_format must be one of 'markdown' or 'json', \"\n                f\"got {table_format!r}.\",\n            )\n        self.include_image = include_image\n        self.separate_table = separate_table\n        self.table_format = table_format\n\n    async def parse(\n        self,\n        file: bytes | str,\n        filename: str,\n    ) -> list[Section]:\n        \"\"\"Parse a DOCX file into a list of :class:`Section` objects.\n\n        Args:\n            file (`bytes | str`):\n                Either the raw DOCX bytes, or a filesystem path to the\n                DOCX file.","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/agentscope-ai/agentscope/blob/e90f1c7592896cc95f6e5ee506194f533378247d/src/agentscope/rag/_parser/_word.py#L210-L246","documentation":"WordParser.__init__ validates its table_format argument and only accepts 'markdown' or 'json'; any other string raises ValueError at construction time.","triggerScenarios":"WordParser(table_format='csv') or 'html', 'md', 'JSON' (case-sensitive), or passing a table_format intended for another parser.","commonSituations":"Copy-pasting config from a different library, typos, or assuming case-insensitivity; often caught when constructing parsers programmatically from a config dict.","solutions":["Use exactly 'markdown' or 'json'","Check spelling/case if building from config","Validate config values before parser construction"],"exampleFix":"# before\nwp = WordParser(table_format='md')\n# after\nwp = WordParser(table_format='markdown')","handlingStrategy":"validation","validationCode":"assert table_format in ('markdown', 'json')","typeGuard":"def is_valid_table_format(v: str) -> bool:\n    return v in ('markdown', 'json')","tryCatchPattern":null,"preventionTips":["Validate config values against the documented enum before constructing parsers","Use constants instead of free-form strings"],"tags":["validation","constructor","word","config"],"backgroundTag":"invalid-argument-value","analyzedSha":"e90f1c7592896cc95f6e5ee506194f533378247d","analyzedAt":"2026-08-28T18:24:12.087Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}