{"record":{"id":"7fa0b8707fea2b12","repo":"deepset-ai/haystack","slug":"row-split-threshold-must-be-greater-than-0","errorCode":null,"errorMessage":"row_split_threshold must be greater than 0","messagePattern":"row_split_threshold must be greater than 0","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"haystack/components/preprocessors/csv_document_splitter.py","lineNumber":61,"sourceCode":"        :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]]:\n        \"\"\"\n        Processes and splits a list of CSV documents into multiple sub-tables.\n\n        **Splitting Process:**","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/preprocessors/csv_document_splitter.py#L43-L79","documentation":"CSVDocumentSplitter requires row_split_threshold to be None or >= 1 when used; values less than 1 (0 or negative) are rejected in __init__ with ValueError. The threshold counts consecutive empty rows that trigger a split.","triggerScenarios":"CSVDocumentSplitter(row_split_threshold=0) or a negative value; typically when column_split_threshold is also set (threshold mode) or alone.","commonSituations":"Setting 0 to mean 'disable' instead of passing None; config defaults of 0; confusing 'disable' semantics with the None sentinel.","solutions":["Set row_split_threshold to a positive integer (>= 1) or None to disable it.","Pass None instead of 0 when the threshold should be unused.","Ensure at least one of row/column thresholds is specified, since both None raises a separate error."],"exampleFix":"// before\nCSVDocumentSplitter(split_mode=\"threshold\", row_split_threshold=0)\n// after\nCSVDocumentSplitter(split_mode=\"threshold\", row_split_threshold=None, column_split_threshold=2)","handlingStrategy":"validation","validationCode":"if row_split_threshold is not None and row_split_threshold < 1:\n    raise ValueError(\"row_split_threshold must be >= 1 or None\")\nsplitter = CSVDocumentSplitter(row_split_threshold=row_split_threshold, column_split_threshold=col_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\", row_split_threshold=t)\nexcept ValueError as e:\n    logger.warning(\"invalid row_split_threshold %r: %s\", t, e)\n    splitter = CSVDocumentSplitter(split_mode=\"threshold\", row_split_threshold=None, column_split_threshold=2)","preventionTips":["Use None, not 0, to disable a threshold","Enforce minimum of 1 when reading config values","Keep at least one threshold set to avoid the both-None error"],"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"}