{"record":{"id":"bf26257743cca8e4","repo":"MiniMax-AI/skills","slug":"unsupported-file-format-suffix-supported-forma","errorCode":null,"errorMessage":"Unsupported file format: {suffix}. Supported formats: .xlsx, .xlsm, .csv, .tsv","messagePattern":"Unsupported file format: (.+?)\\. Supported formats: \\.xlsx, \\.xlsm, \\.csv, \\.tsv","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"warning","filePath":"skills/minimax-xlsx/scripts/xlsx_reader.py","lineNumber":84,"sourceCode":"                df = pd.read_csv(file_path, sep=sep, encoding=enc)\n                df._reader_encoding = enc  # attach metadata (non-standard, for reporting)\n                return {path.stem: df}\n            except (UnicodeDecodeError, Exception) as e:\n                last_error = e\n                continue\n        raise ValueError(\n            f\"Cannot decode {file_path}. Tried encodings: {encodings}. \"\n            f\"Last error: {last_error}\"\n        )\n\n    elif suffix == \".xls\":\n        raise ValueError(\n            \".xls is a legacy binary format not supported by this tool. \"\n            \"Please open the file in Excel and save as .xlsx, then retry.\"\n        )\n\n    else:\n        raise ValueError(\n            f\"Unsupported file format: {suffix}. \"\n            \"Supported formats: .xlsx, .xlsm, .csv, .tsv\"\n        )\n\n\n# ---------------------------------------------------------------------------\n# Structure discovery\n# ---------------------------------------------------------------------------\n\ndef explore_structure(sheets: dict) -> dict:\n    \"\"\"\n    Return a structured dict describing each sheet.\n    Keys: sheet_name -> {shape, columns, dtypes, null_counts, preview}\n    \"\"\"\n    result = {}\n    for sheet_name, df in sheets.items():\n        null_counts = df.isnull().sum()\n        null_info = {","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/MiniMax-AI/skills/blob/60aaae52bb2af8162732751a4332f62a5fef518b/skills/minimax-xlsx/scripts/xlsx_reader.py#L66-L102","documentation":"The suffix matches none of .xlsx/.xlsm/.csv/.tsv/.xls, so detect_and_load() rejects it with ValueError listing the supported formats. The suffix is lowercased before comparison, so .XLSX is accepted but .ods/.numbers/.txt/.parquet are not.","triggerScenarios":"Passing .ods, .numbers, .txt, .parquet, .json, or any other unrecognized extension.","commonSituations":"Exporting from Google Sheets as .ods; passing a .txt assuming it reads as CSV; Mac Numbers export; a data file in a format the tool never claimed to support.","solutions":["Convert/save to a supported format (.xlsx, .xlsm, .csv, or .tsv).","If the content is actually CSV, rename the extension to .csv.","For .ods, export to .xlsx from LibreOffice/Google Sheets."],"exampleFix":"# before\npython3 xlsx_reader.py data.ods   # ValueError: Unsupported file format: .ods\n\n# after\nlibreoffice --headless --convert-to xlsx data.ods\npython3 xlsx_reader.py data.xlsx","handlingStrategy":"validation","validationCode":"from pathlib import Path\nSUPPORTED = {'.xlsx', '.xlsm', '.csv', '.tsv'}\nsuf = Path(file_path).suffix.lower()\nif suf not in SUPPORTED:\n    raise ValueError(f'Unsupported file format: {suf}. Supported: {sorted(SUPPORTED)}')","typeGuard":"def is_supported_format(p) -> bool:\n    return Path(p).suffix.lower() in {'.xlsx', '.xlsm', '.csv', '.tsv'}","tryCatchPattern":"try:\n    sheets = detect_and_load(file_path)\nexcept ValueError as e:\n    if 'Unsupported file format' in str(e):\n        print(f'Convert {file_path} to .xlsx/.csv/.tsv first.', file=sys.stderr)\n    raise","preventionTips":["Validate the extension against the supported set before calling.","Normalize exports to .xlsx or .csv at the source.","Use Path.suffix.lower() so case variants are handled."],"tags":["file-format","validation","python"],"backgroundTag":null,"analyzedSha":"60aaae52bb2af8162732751a4332f62a5fef518b","analyzedAt":"2026-08-13T17:32:34.717Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}