Agent FixboardAgentFixboard

Large CSV knowledge source fails with an embedder token limit error

A large CSV on CSVKnowledgeSource fails while embedding. The error text is 'Requested 722281 tokens, max 300000 tokens per request'.

From GitHub

crewAIInc/crewAI

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
0.201.0
Last checked

Verified fix: PR #3585 merged on . Fixed in 0.201.0 (first published release whose tag contains the merge commit). Last checked .

Symptom

A large CSV on CSVKnowledgeSource fails while embedding. The error text is 'Requested 722281 tokens, max 300000 tokens per request'.

Evidence what you'll see

  • The report's file is about 150 rows, about 434,000 words, about 2.7 MB, at a path like path/to/very-large.csv.
  • The same failure happens when the rows are split across files, if those files are on one CSVKnowledgeSource.
  • A comment says setting chunk_size and chunk_overlap still sends every chunk in one request.

Why it happens

CSVKnowledgeSource saves through BaseFileKnowledgeSource._save_documents, which calls self.storage.save(self.chunks) with every chunk. Storage then upserts the whole list in one call, and that call is one embedder request. Making the chunks smaller does not create more requests. The request is one per save, not one per chunk.

Affected versions

CrewAI 0.186.1 and crewai-tools 0.186.1, Ubuntu 20.04, Python 3.12, venv.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

How to check it worked

  • Kick off the same crew with the same CSV. The knowledge source loads, and the run does not fail with Requested 722281 tokens, max 300000 tokens per request.

If it still fails

  • Tuning chunk_size is not a substitute. The reporter tried it, and a maintainer comment agrees the upsert sends the prepared documents together.
  • The linked issue does not name a release whose notes list pull request 3585.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it