crewAIInc/crewAI · error · ValueError
No chunker defined for {self}
Error message
No chunker defined for {self} What it means
DataType.get_chunker() maps each DataType enum member to a (module, class) chunker pair; if the enum value is not a key in that mapping, it raises ValueError('No chunker defined for ...'). This indicates a DataType that exists as an enum member but has no chunker registered — effectively an internal invariant break or an enum extended without updating the registry.
Source
Thrown at lib/crewai-tools/src/crewai_tools/rag/data_types.py:54
DataType.TEXT_FILE: ("text_chunker", "TextChunker"),
DataType.TEXT: ("text_chunker", "TextChunker"),
DataType.DOCX: ("text_chunker", "DocxChunker"),
DataType.MDX: ("text_chunker", "MdxChunker"),
DataType.CSV: ("structured_chunker", "CsvChunker"),
DataType.JSON: ("structured_chunker", "JsonChunker"),
DataType.XML: ("structured_chunker", "XmlChunker"),
DataType.WEBSITE: ("web_chunker", "WebsiteChunker"),
DataType.DIRECTORY: ("text_chunker", "TextChunker"),
DataType.YOUTUBE_VIDEO: ("text_chunker", "TextChunker"),
DataType.YOUTUBE_CHANNEL: ("text_chunker", "TextChunker"),
DataType.GITHUB: ("text_chunker", "TextChunker"),
DataType.DOCS_SITE: ("text_chunker", "TextChunker"),
DataType.MYSQL: ("text_chunker", "TextChunker"),
DataType.POSTGRES: ("text_chunker", "TextChunker"),
}
if self not in chunkers:
raise ValueError(f"No chunker defined for {self}")
module_name, class_name = chunkers[self]
module_path = f"crewai_tools.rag.chunkers.{module_name}"
try:
module = import_module(module_path)
return cast(BaseChunker, getattr(module, class_name)())
except Exception as e:
raise ValueError(f"Error loading chunker for {self}: {e}") from e
def get_loader(self) -> BaseLoader:
loaders = {
DataType.PDF_FILE: ("pdf_loader", "PDFLoader"),
DataType.TEXT_FILE: ("text_loader", "TextFileLoader"),
DataType.TEXT: ("text_loader", "TextLoader"),
DataType.XML: ("xml_loader", "XMLLoader"),
DataType.WEBSITE: ("webpage_loader", "WebPageLoader"),
DataType.MDX: ("mdx_loader", "MDXLoader"),
DataType.JSON: ("json_loader", "JSONLoader"),View on GitHub (pinned to 754d7323be)
Solutions
- Use a supported DataType from the documented mapping
- If you extended the enum, also add a matching chunker entry (subclass or patch get_chunker)
- Pin/upgrade crewai-tools to a version where the DataType you use is fully registered
- Fall back to text_chunker semantics via DataType.TEXT if the source is plain text
Example fix
# before dtype = DataType.CUSTOM # hypothetical unregistered member chunker = dtype.get_chunker() # after dtype = DataType.TEXT chunker = dtype.get_chunker()
Defensive patterns
Strategy: fallback
Validate before calling
SUPPORTED_CHUNKERS = {DataType.PDF_FILE, DataType.TEXT_FILE, DataType.TEXT, DataType.XML, DataType.WEBSITE, DataType.DIRECTORY, DataType.YOUTUBE_VIDEO, DataType.YOUTUBE_CHANNEL, DataType.GITHUB, DataType.DOCS_SITE, DataType.MYSQL, DataType.POSTGRES}
if dtype not in SUPPORTED_CHUNKERS:
dtype = DataType.TEXT # safe fallback for plain text Type guard
def has_chunker(dt: DataType) -> bool:
try:
dt.get_chunker(); return True
except ValueError:
return False Try / catch
try:
chunker = dtype.get_chunker()
except ValueError as e:
if 'No chunker defined' in str(e):
chunker = DataType.TEXT.get_chunker()
else:
raise Prevention
- Whitelist DataTypes you support in your ingestion pipeline
- Log the DataType returned by DataTypes.from_content before using it
- If extending the enum, register chunker and loader entries in the same commit
When it happens
Trigger: A new DataType member added to the enum without a chunkers[] entry, or constructing the tool path where get_chunker() is called on such a member (the mapping shows entries for XML, WEBSITE, DIRECTORY, YOUTUBE_*, GITHUB, DOCS_SITE, MYSQL, POSTGRES; a member outside these and the file types raises).
Common situations: Library version skew after adding a custom DataType via monkey-patching; downstream forks adding enum members without patching the registry.
Related errors
- No loader defined for {self}
- Invalid data_type: '{raw_data_type}'. Valid values are: 'fil
- Chunk overlap ({chunk_overlap}) cannot be >= chunk size ({ch
- Error loading chunker for {self}: {e}
- Skill {ref} not found. Ensure it has been published and you
AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15).
Data as JSON: /api/errors/69ee5dbb4bb41caa.
Report an issue: GitHub.