# Knowledge fixes for DocumentChunking and the CSV readers

> Agno's DocumentChunking now raises ValueError when overlap is not smaller than chunk_size, and CSVReader and FieldLabeledCSVReader read files whose records end in a bare carriage return.

- Published: 2026-10-01
- Author: IronMurphy
- Categories: Changelog
- Canonical: https://www.agno.com/blog/knowledge-fixes-for-documentchunking-and-the-csv-readers
- Markdown: https://www.agno.com/blog/knowledge-fixes-for-documentchunking-and-the-csv-readers.md

Agno's `DocumentChunking` and both CSV readers each got a fix for input that went wrong without a clear error. The outputs below are real, from the previous release and this one.

### `DocumentChunking` checks its overlap

`FixedSizeChunking` and `RecursiveChunking` already raised for `overlap >= chunk_size`. `DocumentChunking` accepted it and built chunks longer than `chunk_size`, so the three strategies disagreed about a valid setting. It now runs the same check in its constructor:

```python
DocumentChunking(chunk_size=100, overlap=150).chunk(doc)
# Before: chunk lengths [109, 206, 206, 206]
# Now:    ValueError: Invalid parameters: overlap (150) must be less than chunk size (100).
```

### CSV readers handle CR record endings

`CSVReader` and `FieldLabeledCSVReader` wrapped uploaded content in a `StringIO` with the default newline handling. For records that end in `\r`, `csv.reader` raised `new-line character seen in unquoted field`, and the readers logged it and returned no documents. Uploads in both sync and async mode hit this, and so did async reads of a file path. All six wrappers now pass `newline=""`, as the sync path reads already did, which accepts LF, CRLF and CR and keeps quoted multiline cells. Reading `name,city\rAlice,Paris\rBob,Rome\r`:

```text
Before: CSVReader 0 documents, FieldLabeledCSVReader 0 documents
Now:    CSVReader 3 documents: 'name, city', 'Alice, Paris', 'Bob, Rome'
        FieldLabeledCSVReader 2 documents: 'Name: Alice\nCity: Paris', 'Name: Bob\nCity: Rome'
```

See the [cookbook](https://github.com/agno-agi/agno/blob/main/cookbook/07_knowledge/09_archive/readers/csv_reader.py), and learn more about [document chunking](https://docs.agno.com/knowledge/concepts/chunking/document-chunking) and the [CSV reader](https://docs.agno.com/knowledge/concepts/readers/csv-reader) in the documentation.
