deepset-ai/haystack · error
Unknown table format '{string}'. Supported formats are: {lis
Error message
Unknown table format '{string}'. Supported formats are: {list(enum_map.keys())} What it means
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.
Source
Thrown at haystack/components/converters/docx.py:90
Supported formats for storing DOCX tabular data in a Document.
"""
MARKDOWN = "markdown"
CSV = "csv"
def __str__(self) -> str:
return self.value
@staticmethod
def from_str(string: str) -> "DOCXTableFormat":
"""
Convert a string to a DOCXTableFormat enum.
"""
enum_map = {e.value: e for e in DOCXTableFormat}
table_format = enum_map.get(string.lower())
if table_format is None:
msg = f"Unknown table format '{string}'. Supported formats are: {list(enum_map.keys())}"
raise ValueError(msg)
return table_format
DOCXLinkFormat = LinkFormat
@component
class DOCXToDocument:
"""
Converts DOCX files to Documents.
Uses `python-docx` library to convert the DOCX file to a document.
This component does not preserve page breaks in the original document.
Usage example:
```python
from haystack.components.converters.docx import DOCXToDocument, DOCXTableFormat, DOCXLinkFormatView on GitHub (pinned to e318778c9b)
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.
Example fix
// before
fmt = DOCXTableFormat.from_str("markdown-table")
// after
fmt = DOCXTableFormat.from_str("markdown") Defensive patterns
Strategy: validation
Validate before calling
VALID = {e.value for e in DOCXTableFormat}
fmt_input = fmt_input.strip().lower()
if fmt_input not in VALID:
raise ValueError(f"{fmt_input!r} not in {sorted(VALID)}") Type guard
def is_valid_table_format(s: str) -> bool:
return s.strip().lower() in {e.value for e in DOCXTableFormat} Try / catch
try:
fmt = DOCXTableFormat.from_str(user_input)
except ValueError as e:
logger.warning("%s; defaulting to %s", e, DOCXTableFormat.CSV)
fmt = DOCXTableFormat.CSV Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Typo in pipeline YAML; using format names from another library (e.g. pandas to_markdown variants); copy-pasting with trailing spaces or quotes.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unknown extraction mode '{string}'. Supported modes are: {li
- Unknown link format '{string}'. Supported formats are: {list
- CSVToDocument: quotechar must be a single character.
- Unsupported source type {type(source)}
- The length of the metadata list must match the number of sou
AI-assisted analysis of deepset-ai/haystack@e318778c9b (2026-08-30).
Data as JSON: /api/errors/ec11aefafcc8f7ec.
Report an issue: GitHub.