{"record":{"id":"4d1009b8231fec1d","repo":"deepset-ai/haystack","slug":"split-mode-split-mode-not-recognized-choose-o","errorCode":null,"errorMessage":"Split mode '{split_mode}' not recognized. Choose one among: {', '.join(get_args(SplitMode))}.","messagePattern":"Split mode '(.+?)' not recognized\\. Choose one among: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"haystack/components/preprocessors/csv_document_splitter.py","lineNumber":57,"sourceCode":"        \"\"\"\n        Initializes the CSVDocumentSplitter component.\n\n        :param row_split_threshold: The minimum number of consecutive empty rows required to trigger a split.\n        :param column_split_threshold: The minimum number of consecutive empty columns required to trigger a split.\n        :param read_csv_kwargs: Additional keyword arguments to pass to `pandas.read_csv`.\n            By default, the component with options:\n            - `header=None`\n            - `skip_blank_lines=False` to preserve blank lines\n            - `dtype=object` to prevent type inference (e.g., converting numbers to floats).\n            See https://pandas.pydata.org/docs/reference/api/pandas.read_csv.html for more information.\n        :param split_mode:\n            If `threshold`, the component will split the document based on the number of\n            consecutive empty rows or columns that exceed the `row_split_threshold` or `column_split_threshold`.\n            If `row-wise`, the component will split each row into a separate sub-table.\n        \"\"\"\n        pandas_import.check()\n        if split_mode not in get_args(SplitMode):\n            raise ValueError(\n                f\"Split mode '{split_mode}' not recognized. Choose one among: {', '.join(get_args(SplitMode))}.\"\n            )\n        if row_split_threshold is not None and row_split_threshold < 1:\n            raise ValueError(\"row_split_threshold must be greater than 0\")\n\n        if column_split_threshold is not None and column_split_threshold < 1:\n            raise ValueError(\"column_split_threshold must be greater than 0\")\n\n        if row_split_threshold is None and column_split_threshold is None:\n            raise ValueError(\"At least one of row_split_threshold or column_split_threshold must be specified.\")\n\n        self.row_split_threshold = row_split_threshold\n        self.column_split_threshold = column_split_threshold\n        self.read_csv_kwargs = read_csv_kwargs or {}\n        self.split_mode = split_mode\n\n    @component.output_types(documents=list[Document])\n    def run(self, documents: list[Document]) -> dict[str, list[Document]]:","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/preprocessors/csv_document_splitter.py#L39-L75","documentation":"CSVDocumentSplitter.__init__ validates split_mode against the SplitMode Literal ('row-wise', 'column-wise', 'threshold'). An unrecognized string raises ValueError listing the valid options.","triggerScenarios":"CSVDocumentSplitter(split_mode='rows'), split_mode='ROW-WISE' (wrong casing), or any string outside get_args(SplitMode).","commonSituations":"Typos or shorthand; wrong casing; assuming modes from other splitters (e.g. sentence/page splitters) apply here.","solutions":["Use one of the exact allowed strings: 'row-wise', 'column-wise', or 'threshold'.","Fix casing — comparison is case-sensitive lowercase.","Check get_args(SplitMode) from haystack.components.preprocessors.csv_document_splitter for the authoritative list."],"exampleFix":"// before\nCSVDocumentSplitter(split_mode=\"rows\")\n// after\nCSVDocumentSplitter(split_mode=\"row-wise\")","handlingStrategy":"validation","validationCode":"from typing import get_args\nfrom haystack.components.preprocessors.csv_document_splitter import SplitMode\nVALID = get_args(SplitMode)\nassert split_mode in VALID, f\"split_mode must be one of {VALID}, got {split_mode!r}\"","typeGuard":"def is_split_mode(s: str) -> bool:\n    from typing import get_args\n    from haystack.components.preprocessors.csv_document_splitter import SplitMode\n    return s in get_args(SplitMode)","tryCatchPattern":"try:\n    splitter = CSVDocumentSplitter(split_mode=mode)\nexcept ValueError as e:\n    logger.error(\"bad split_mode %r: %s\", mode, e)\n    splitter = CSVDocumentSplitter(split_mode=\"row-wise\", row_split_threshold=2)","preventionTips":["Use only the literal strings 'row-wise', 'column-wise', 'threshold'","Comparison is case-sensitive; avoid .upper() transforms","Check SplitMode Literal definition for the authoritative list"],"tags":["validation","enum","haystack"],"backgroundTag":"invalid-enum-value","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}