{"record":{"id":"ec11aefafcc8f7ec","repo":"deepset-ai/haystack","slug":"unknown-table-format-string-supported-formats","errorCode":null,"errorMessage":"Unknown table format '{string}'. Supported formats are: {list(enum_map.keys())}","messagePattern":"Unknown table format '(.+?)'\\. Supported formats are: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"haystack/components/converters/docx.py","lineNumber":90,"sourceCode":"    Supported formats for storing DOCX tabular data in a Document.\n    \"\"\"\n\n    MARKDOWN = \"markdown\"\n    CSV = \"csv\"\n\n    def __str__(self) -> str:\n        return self.value\n\n    @staticmethod\n    def from_str(string: str) -> \"DOCXTableFormat\":\n        \"\"\"\n        Convert a string to a DOCXTableFormat enum.\n        \"\"\"\n        enum_map = {e.value: e for e in DOCXTableFormat}\n        table_format = enum_map.get(string.lower())\n        if table_format is None:\n            msg = f\"Unknown table format '{string}'. Supported formats are: {list(enum_map.keys())}\"\n            raise ValueError(msg)\n        return table_format\n\n\nDOCXLinkFormat = LinkFormat\n\n\n@component\nclass DOCXToDocument:\n    \"\"\"\n    Converts DOCX files to Documents.\n\n    Uses `python-docx` library to convert the DOCX file to a document.\n    This component does not preserve page breaks in the original document.\n\n    Usage example:\n\n    ```python\n    from haystack.components.converters.docx import DOCXToDocument, DOCXTableFormat, DOCXLinkFormat","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/converters/docx.py#L72-L108","documentation":"DOCXTableFormat.from_str converts a user string into the DOCXTableFormat enum by exact (case-insensitive) value match. If the string is not one of the enum's values, it raises ValueError listing the valid options.","triggerScenarios":"Calling DOCXTableFormat.from_str('markdown-table') or passing table_format='csv ' with whitespace, or a synonym like 'grid' that is not an enum value, to a DOCX converter.","commonSituations":"Typo in pipeline YAML; using format names from another library (e.g. pandas to_markdown variants); copy-pasting with trailing spaces or quotes.","solutions":["Use one of the listed supported values from the error message, e.g. from_str('csv').","Trim whitespace and lowercase the string before calling (from_str lowercases already, but strip spaces).","Update the config key to a valid enum value.","Check the enum definition in haystack/components/converters/docx.py for exact accepted values."],"exampleFix":"// before\nfmt = DOCXTableFormat.from_str(\"markdown-table\")\n// after\nfmt = DOCXTableFormat.from_str(\"markdown\")","handlingStrategy":"validation","validationCode":"VALID = {e.value for e in DOCXTableFormat}\nfmt_input = fmt_input.strip().lower()\nif fmt_input not in VALID:\n    raise ValueError(f\"{fmt_input!r} not in {sorted(VALID)}\")","typeGuard":"def is_valid_table_format(s: str) -> bool:\n    return s.strip().lower() in {e.value for e in DOCXTableFormat}","tryCatchPattern":"try:\n    fmt = DOCXTableFormat.from_str(user_input)\nexcept ValueError as e:\n    logger.warning(\"%s; defaulting to %s\", e, DOCXTableFormat.CSV)\n    fmt = DOCXTableFormat.CSV","preventionTips":["Copy accepted values from the enum definition, not from other libraries' docs.","Strip and lowercase user/config input before from_str().","Expose the valid options in your app's config UI or schema.","Add a test asserting every configured format parses."],"tags":["python","docx","enum","valueerror"],"backgroundTag":"invalid-enum-value","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}