{"record":{"id":"ee656b4a07c1cd41","repo":"can1357/oh-my-pi","slug":"invalid-pptx-missing-presentation-xml","errorCode":null,"errorMessage":"Invalid PPTX: missing presentation.xml","messagePattern":"Invalid PPTX: missing presentation\\.xml","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/markit/converters/pptx.ts","lineNumber":118,"sourceCode":"\tname = \"pptx\";\n\n\taccepts(streamInfo: StreamInfo): boolean {\n\t\tif (streamInfo.extension && EXTENSIONS.includes(streamInfo.extension)) return true;\n\t\tif (streamInfo.mimetype && MIMETYPES.some(m => streamInfo.mimetype?.startsWith(m))) return true;\n\t\treturn false;\n\t}\n\n\tasync convert(input: Buffer, streamInfo: StreamInfo): Promise<ConversionResult> {\n\t\tconst entries = await readArchiveEntries({ bytes: input, format: \"zip\" });\n\t\tconst parser = new XMLParser({\n\t\t\tignoreAttributes: false,\n\t\t\tattributeNamePrefix: \"@_\",\n\t\t\ttextNodeName: \"#text\",\n\t\t\tprocessEntities: { maxTotalExpansions: 1_000_000 },\n\t\t});\n\t\t// Get slide order from presentation.xml\n\t\tconst presXml = archiveEntryText(entries, \"ppt/presentation.xml\");\n\t\tif (!presXml) throw new Error(\"Invalid PPTX: missing presentation.xml\");\n\t\tconst pres = parser.parse(presXml) as PresentationDoc;\n\t\tconst sldIdList = pres[\"p:presentation\"]?.[\"p:sldIdLst\"]?.[\"p:sldId\"];\n\t\tconst sldIds = Array.isArray(sldIdList) ? sldIdList : sldIdList ? [sldIdList] : [];\n\t\t// Get relationship mappings\n\t\tconst relsXml = archiveEntryText(entries, \"ppt/_rels/presentation.xml.rels\");\n\t\tconst rels = relsXml ? (parser.parse(relsXml) as RelationshipsDoc) : null;\n\t\tconst relList = rels?.Relationships?.Relationship;\n\t\tconst relArray = Array.isArray(relList) ? relList : relList ? [relList] : [];\n\t\tconst relMap = new Map<string, string>();\n\t\tfor (const r of relArray) {\n\t\t\trelMap.set(r[\"@_Id\"], r[\"@_Target\"]);\n\t\t}\n\t\t// Map slide IDs to file paths in order\n\t\tconst slidePaths: string[] = [];\n\t\tfor (const sld of sldIds) {\n\t\t\tconst rId = sld[\"@_r:id\"];\n\t\t\tconst target = relMap.get(rId);\n\t\t\tif (target) slidePaths.push(`ppt/${target}`);","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/markit/converters/pptx.ts#L100-L136","documentation":"The PPTX converter requires ppt/presentation.xml, the main OPC part describing the slide id list and references. If the archive has no entry at that exact path, convert() throws this error — the file is not a valid PowerPoint package.","triggerScenarios":"Calling the PPTX converter on a ZIP that lacks ppt/presentation.xml.","commonSituations":"File is a renamed/non-PowerPoint archive (e.g. an ODP renamed to .pptx, or a plain ZIP of slides); the pptx was produced by a non-Office tool omitting the presentation part; corruption or manual edits removed the part.","solutions":["Verify the file: unzip -l file.pptx should list ppt/presentation.xml; if absent it is not a valid PPTX.","Open and re-save the file in PowerPoint/LibreOffice to regenerate a valid package.","Convert the actual source format with the right tool (e.g. ODP → xlsx-style proper conversion).","If generating pptx programmatically, ensure the presentation part is emitted at ppt/presentation.xml."],"exampleFix":"// before\nawait markit.convert(\"slides.zip\", \"application/vnd.openxmlformats-officedocument.presentationml.presentation\");\n// after: export a genuine .pptx from PowerPoint/LibreOffice first\nawait markit.convert(\"slides.pptx\", \"application/vnd.openxmlformats-officedocument.presentationml.presentation\");","handlingStrategy":"validation","validationCode":"async function isPlausiblePptx(path: string, listEntries: (p: string) => Promise<string[]>): Promise<boolean> {\n  const names = await listEntries(path);\n  return names.includes(\"ppt/presentation.xml\") && names.includes(\"[Content_Types].xml\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  const out = await markit.convertFile(\"deck.pptx\");\n} catch (err) {\n  if (err instanceof Error && err.message === \"Invalid PPTX: missing presentation.xml\") {\n    throw new Error(\"deck.pptx is not a valid OOXML presentation; re-export from PowerPoint/LibreOffice\");\n  }\n  throw err;\n}","preventionTips":["Never rename ODP/ZIP files to .pptx; convert properly.","Sanity-check the archive contains ppt/presentation.xml before conversion.","Re-save suspect files in PowerPoint/LibreOffice to regenerate the package.","Validate downloads (size/checksum) to catch truncated files."],"tags":["pptx","ooxml","file-format","markitdown"],"backgroundTag":"invalid-pptx-package","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}