{"record":{"id":"103da3c62cc92bdf","repo":"FoundationAgents/MetaGPT","slug":"file-format-not-supported","errorCode":null,"errorMessage":"File format not supported.","messagePattern":"File format not supported\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"metagpt/document.py","lineNumber":46,"sourceCode":"\ndef read_data(data_path: Path) -> Union[pd.DataFrame, list[Document]]:\n    suffix = data_path.suffix\n    if \".xlsx\" == suffix:\n        data = pd.read_excel(data_path)\n    elif \".csv\" == suffix:\n        data = pd.read_csv(data_path)\n    elif \".json\" == suffix:\n        data = pd.read_json(data_path)\n    elif suffix in (\".docx\", \".doc\"):\n        data = SimpleDirectoryReader(input_files=[str(data_path)]).load_data()\n    elif \".txt\" == suffix:\n        data = SimpleDirectoryReader(input_files=[str(data_path)]).load_data()\n        node_parser = SimpleNodeParser.from_defaults(separator=\"\\n\", chunk_size=256, chunk_overlap=0)\n        data = node_parser.get_nodes_from_documents(data)\n    elif \".pdf\" == suffix:\n        data = PDFReader.load_data(str(data_path))\n    else:\n        raise NotImplementedError(\"File format not supported.\")\n    return data\n\n\nclass DocumentStatus(Enum):\n    \"\"\"Indicates document status, a mechanism similar to RFC/PEP\"\"\"\n\n    DRAFT = \"draft\"\n    UNDERREVIEW = \"underreview\"\n    APPROVED = \"approved\"\n    DONE = \"done\"\n\n\nclass Document(BaseModel):\n    \"\"\"\n    Document: Handles operations related to document files.\n    \"\"\"\n\n    path: Path = Field(default=None)","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/FoundationAgents/MetaGPT/blob/11cdf466d042aece04fc6cfd13b28e1a70341b1f/metagpt/document.py#L28-L64","documentation":"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.","triggerScenarios":"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.","commonSituations":"Trying to index markdown or HTML knowledge bases; uppercase extensions from Windows; assuming llama_index readers cover arbitrary formats because .docx/.txt use SimpleDirectoryReader.","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."],"exampleFix":"# before\ndoc = IndexableDocument.from_path(Path('kb.MD'))  # NotImplementedError\n\n# after\np = Path('kb.MD')\ndoc = 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)","handlingStrategy":"validation","validationCode":"SUPPORTED = {'.xlsx', '.csv', '.json', '.docx', '.doc', '.txt', '.pdf'}\np = p.with_suffix(p.suffix.lower())\nif p.suffix not in SUPPORTED:\n    p = convert_document(p, target='.pdf')\ndoc = IndexableDocument.from_path(p)","typeGuard":"def is_supported_data_file(p: Path) -> bool:\n    return p.suffix.lower() in {'.xlsx', '.csv', '.json', '.docx', '.doc', '.txt', '.pdf'}","tryCatchPattern":"try:\n    doc = IndexableDocument.from_path(p)\nexcept NotImplementedError:\n    from llama_index.core import SimpleDirectoryReader\n    data = SimpleDirectoryReader(input_files=[str(p)]).load_data()","preventionTips":["Normalize file suffixes to lowercase before dispatch.","Convert markdown/html sources to txt or pdf.","Validate the extension at upload time and reject early."],"tags":["file-format","rag","document","not-implemented"],"backgroundTag":null,"analyzedSha":"11cdf466d042aece04fc6cfd13b28e1a70341b1f","analyzedAt":"2026-08-14T23:20:02.994Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}