FoundationAgents/MetaGPT · error · NotImplementedError
File format not supported.
Error message
File format not supported.
What it means
read_data in metagpt/document.py dispatches on file suffix and only accepts .xlsx, .csv, .json, .docx/.doc, .txt, and .pdf. Any other suffix falls through to raise NotImplementedError('File format not supported.'), so IndexableDocument.from_path cannot ingest that file type.
Source
Thrown at metagpt/document.py:46
def read_data(data_path: Path) -> Union[pd.DataFrame, list[Document]]:
suffix = data_path.suffix
if ".xlsx" == suffix:
data = pd.read_excel(data_path)
elif ".csv" == suffix:
data = pd.read_csv(data_path)
elif ".json" == suffix:
data = pd.read_json(data_path)
elif suffix in (".docx", ".doc"):
data = SimpleDirectoryReader(input_files=[str(data_path)]).load_data()
elif ".txt" == suffix:
data = SimpleDirectoryReader(input_files=[str(data_path)]).load_data()
node_parser = SimpleNodeParser.from_defaults(separator="\n", chunk_size=256, chunk_overlap=0)
data = node_parser.get_nodes_from_documents(data)
elif ".pdf" == suffix:
data = PDFReader.load_data(str(data_path))
else:
raise NotImplementedError("File format not supported.")
return data
class DocumentStatus(Enum):
"""Indicates document status, a mechanism similar to RFC/PEP"""
DRAFT = "draft"
UNDERREVIEW = "underreview"
APPROVED = "approved"
DONE = "done"
class Document(BaseModel):
"""
Document: Handles operations related to document files.
"""
path: Path = Field(default=None)View on GitHub (pinned to 11cdf466d0)
Solutions
- Convert the file to a supported format (pdf/txt/docx) before indexing.
- Normalize the suffix: p = p.with_suffix(p.suffix.lower()).
- For formats llama_index supports (e.g. markdown), load documents yourself with SimpleDirectoryReader and construct the IndexableDocument from data instead of from_path.
Example fix
# before
doc = IndexableDocument.from_path(Path('kb.MD')) # NotImplementedError
# after
p = Path('kb.MD')
doc = IndexableDocument.from_path(p.with_suffix(p.suffix.lower())) if p.suffix.lower() in {'.xlsx','.csv','.json','.docx','.doc','.txt','.pdf'} else convert_first(p) Defensive patterns
Strategy: validation
Validate before calling
SUPPORTED = {'.xlsx', '.csv', '.json', '.docx', '.doc', '.txt', '.pdf'}
p = p.with_suffix(p.suffix.lower())
if p.suffix not in SUPPORTED:
p = convert_document(p, target='.pdf')
doc = IndexableDocument.from_path(p) Type guard
def is_supported_data_file(p: Path) -> bool:
return p.suffix.lower() in {'.xlsx', '.csv', '.json', '.docx', '.doc', '.txt', '.pdf'} Try / catch
try:
doc = IndexableDocument.from_path(p)
except NotImplementedError:
from llama_index.core import SimpleDirectoryReader
data = SimpleDirectoryReader(input_files=[str(p)]).load_data() Prevention
- Normalize file suffixes to lowercase before dispatch.
- Convert markdown/html sources to txt or pdf.
- Validate the extension at upload time and reject early.
When it happens
Trigger: IndexableDocument.from_path(Path('notes.md')), .html, .pptx, .eml, or extension-less files. Note the check is exact-suffix: '.MD' or '.PDF' in uppercase also fail the comparison.
Common situations: Trying to index markdown or HTML knowledge bases; uppercase extensions from Windows; assuming llama_index readers cover arbitrary formats because .docx/.txt use SimpleDirectoryReader.
Related errors
- File {data_path} not found.
- The invoice format is not zip, pdf, png, or jpg
- Content column not found in DataFrame.
- File {path} not found.
- File path is not set.
AI-assisted analysis of FoundationAgents/MetaGPT@11cdf466d0 (2026-08-14).
Data as JSON: /api/errors/103da3c62cc92bdf.
Report an issue: GitHub.