{"record":{"id":"845dd8e1d577dc6e","repo":"deepset-ai/haystack","slug":"column-split-threshold-must-be-greater-than-0","errorCode":null,"errorMessage":"column_split_threshold must be greater than 0","messagePattern":"column_split_threshold must be greater than 0","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"haystack/components/preprocessors/csv_document_splitter.py","lineNumber":64,"sourceCode":"            - `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]]:\n        \"\"\"\n        Processes and splits a list of CSV documents into multiple sub-tables.\n\n        **Splitting Process:**\n        1. Applies a row-based split if `row_split_threshold` is provided.\n        2. Applies a column-based split if `column_split_threshold` is provided.\n        3. If both thresholds are specified, performs a recursive split by rows first, then columns, ensuring","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/preprocessors/csv_document_splitter.py#L46-L82","documentation":"CSVDocumentSplitter requires column_split_threshold to be None or >= 1; values less than 1 raise ValueError in __init__. This threshold counts consecutive empty columns that trigger a split.","triggerScenarios":"CSVDocumentSplitter(column_split_threshold=0) or a negative number, usually in 'threshold' split mode.","commonSituations":"Zero used as a 'disable' placeholder instead of None; config parsing yielding 0; misunderstanding that 1 is the minimum meaningful count.","solutions":["Set column_split_threshold to an integer >= 1 or None.","Pass None (not 0) to disable column-based splitting.","Remember at least one of row/column threshold must be non-None."],"exampleFix":"// before\nCSVDocumentSplitter(split_mode=\"threshold\", column_split_threshold=0, row_split_threshold=2)\n// after\nCSVDocumentSplitter(split_mode=\"threshold\", column_split_threshold=None, row_split_threshold=2)","handlingStrategy":"validation","validationCode":"if column_split_threshold is not None and column_split_threshold < 1:\n    raise ValueError(\"column_split_threshold must be >= 1 or None\")\nsplitter = CSVDocumentSplitter(split_mode=\"threshold\", column_split_threshold=col_t, row_split_threshold=row_t)","typeGuard":"def is_valid_threshold(v: int | None) -> bool:\n    return v is None or (isinstance(v, int) and v >= 1)","tryCatchPattern":"try:\n    splitter = CSVDocumentSplitter(split_mode=\"threshold\", column_split_threshold=t)\nexcept ValueError as e:\n    logger.warning(\"invalid column_split_threshold %r: %s\", t, e)\n    splitter = CSVDocumentSplitter(split_mode=\"threshold\", column_split_threshold=None, row_split_threshold=2)","preventionTips":["Pass None (not 0) to disable column splitting","Validate ints from external config before constructing","Remember 1 is the minimum meaningful threshold"],"tags":["validation","python","haystack"],"backgroundTag":"invalid-parameter-value","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}