{"record":{"id":"843f6054bf89d943","repo":"deepset-ai/haystack","slug":"csvtodocument-row-content-column-is-required-i","errorCode":null,"errorMessage":"CSVToDocument(row): 'content_column' is required in run() when conversion_mode='row'.","messagePattern":"CSVToDocument\\(row\\): 'content_column' is required in run\\(\\) when conversion_mode='row'\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"haystack/components/converters/csv.py","lineNumber":148,"sourceCode":"                )\n                continue\n\n            merged_metadata = {**bytestream.meta, **metadata}\n\n            if not self.store_full_path and \"file_path\" in bytestream.meta:\n                file_path = bytestream.meta.get(\"file_path\")\n                if file_path:  # Ensure the value is not None for mypy\n                    merged_metadata[\"file_path\"] = os.path.basename(file_path)\n\n            # Mode: file (backward-compatible default) -> one Document per file\n            if self.conversion_mode == \"file\":\n                documents.append(Document(content=data, meta=merged_metadata))\n                continue\n\n            # --- ROW MODE (strict) ---\n            # Require content_column in run(); no fallback\n            if not content_column:\n                raise ValueError(\n                    \"CSVToDocument(row): 'content_column' is required in run() when conversion_mode='row'.\"\n                )\n\n            # Warn for large CSVs in row mode (memory consideration)\n            try:\n                size_bytes = len(raw)\n                if size_bytes > _ROW_MODE_SIZE_WARN_BYTES:\n                    logger.warning(\n                        \"CSVToDocument(row): parsing a large CSV (~{mb:.1f} MB). \"\n                        \"Consider chunking/streaming if you hit memory issues.\",\n                        mb=size_bytes / (1024 * 1024),\n                    )\n            except Exception:\n                pass\n\n            # Create DictReader; if this fails, raise (no fallback)\n            try:\n                # ``restkey`` ensures surplus fields on ragged rows (rows with more values than the","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/deepset-ai/haystack/blob/e318778c9bf60a1963e3b5f451359655dd696c30/haystack/components/converters/csv.py#L130-L166","documentation":"In row conversion mode, CSVToDocument converts each CSV row into its own Document and needs to know which column holds the text. content_column may only be given at run() time in this mode, and if it is missing the component raises instead of guessing a column.","triggerScenarios":"Calling CSVToDocument(conversion_mode='row').run(sources=[...]) without the content_column keyword argument, or passing content_column=None/empty string.","commonSituations":"Pipelines built for default 'document' mode later switched to 'row' mode in component init without updating the run() call; content_column stored in pipeline config but not wired to run() inputs.","solutions":["Pass content_column='your_column_name' to run().","Confirm conversion_mode='row' is intended; if you want whole-file documents, use the default mode.","Read the column name from the actual CSV header and wire it into the pipeline input.","Validate the run() kwargs in pipeline YAML against the component's run signature."],"exampleFix":"// before\nresult = csv_conv.run(sources=[file])\n// after\nresult = csv_conv.run(sources=[file], content_column=\"text\")","handlingStrategy":"validation","validationCode":"def validate_row_mode_args(mode, content_column):\n    if mode == \"row\" and not content_column:\n        raise ValueError(\"content_column is required when conversion_mode='row'\")\nvalidate_row_mode_args(conv.conversion_mode, content_column)","typeGuard":null,"tryCatchPattern":"try:\n    result = conv.run(sources=sources, content_column=content_column)\nexcept ValueError as e:\n    if \"content_column\" in str(e):\n        raise RuntimeError(\"Pipeline misconfigured: pass content_column for row mode\") from e\n    raise","preventionTips":["Always supply content_column when conversion_mode='row'.","Read the CSV header first and use one of its exact column names.","Keep mode and content_column together in pipeline config/wiring.","Write a smoke test calling run() on a small fixture CSV."],"tags":["python","csv","missing-argument","configuration"],"backgroundTag":"missing-required-parameter","analyzedSha":"e318778c9bf60a1963e3b5f451359655dd696c30","analyzedAt":"2026-08-30T11:45:20.711Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}