can1357/oh-my-pi · error · Error

Invalid PPTX: missing presentation.xml

Error message

Invalid PPTX: missing presentation.xml

What it means

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.

Source

Thrown at packages/coding-agent/src/markit/converters/pptx.ts:118

	name = "pptx";

	accepts(streamInfo: StreamInfo): boolean {
		if (streamInfo.extension && EXTENSIONS.includes(streamInfo.extension)) return true;
		if (streamInfo.mimetype && MIMETYPES.some(m => streamInfo.mimetype?.startsWith(m))) return true;
		return false;
	}

	async convert(input: Buffer, streamInfo: StreamInfo): Promise<ConversionResult> {
		const entries = await readArchiveEntries({ bytes: input, format: "zip" });
		const parser = new XMLParser({
			ignoreAttributes: false,
			attributeNamePrefix: "@_",
			textNodeName: "#text",
			processEntities: { maxTotalExpansions: 1_000_000 },
		});
		// Get slide order from presentation.xml
		const presXml = archiveEntryText(entries, "ppt/presentation.xml");
		if (!presXml) throw new Error("Invalid PPTX: missing presentation.xml");
		const pres = parser.parse(presXml) as PresentationDoc;
		const sldIdList = pres["p:presentation"]?.["p:sldIdLst"]?.["p:sldId"];
		const sldIds = Array.isArray(sldIdList) ? sldIdList : sldIdList ? [sldIdList] : [];
		// Get relationship mappings
		const relsXml = archiveEntryText(entries, "ppt/_rels/presentation.xml.rels");
		const rels = relsXml ? (parser.parse(relsXml) as RelationshipsDoc) : null;
		const relList = rels?.Relationships?.Relationship;
		const relArray = Array.isArray(relList) ? relList : relList ? [relList] : [];
		const relMap = new Map<string, string>();
		for (const r of relArray) {
			relMap.set(r["@_Id"], r["@_Target"]);
		}
		// Map slide IDs to file paths in order
		const slidePaths: string[] = [];
		for (const sld of sldIds) {
			const rId = sld["@_r:id"];
			const target = relMap.get(rId);
			if (target) slidePaths.push(`ppt/${target}`);

View on GitHub (pinned to 9690622007)

Solutions

  1. Verify the file: unzip -l file.pptx should list ppt/presentation.xml; if absent it is not a valid PPTX.
  2. Open and re-save the file in PowerPoint/LibreOffice to regenerate a valid package.
  3. Convert the actual source format with the right tool (e.g. ODP → xlsx-style proper conversion).
  4. If generating pptx programmatically, ensure the presentation part is emitted at ppt/presentation.xml.

Example fix

// before
await markit.convert("slides.zip", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
// after: export a genuine .pptx from PowerPoint/LibreOffice first
await markit.convert("slides.pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation");
Defensive patterns

Strategy: validation

Validate before calling

async function isPlausiblePptx(path: string, listEntries: (p: string) => Promise<string[]>): Promise<boolean> {
  const names = await listEntries(path);
  return names.includes("ppt/presentation.xml") && names.includes("[Content_Types].xml");
}

Try / catch

try {
  const out = await markit.convertFile("deck.pptx");
} catch (err) {
  if (err instanceof Error && err.message === "Invalid PPTX: missing presentation.xml") {
    throw new Error("deck.pptx is not a valid OOXML presentation; re-export from PowerPoint/LibreOffice");
  }
  throw err;
}

Prevention

When it happens

Trigger: Calling the PPTX converter on a ZIP that lacks ppt/presentation.xml.

Common situations: 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.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/ee656b4a07c1cd41. Report an issue: GitHub.