{"record":{"id":"fcf1ca1a7c1ad892","repo":"different-ai/openwork","slug":"no-supported-office-xml-text-entries-were-found","errorCode":null,"errorMessage":"No supported Office XML text entries were found.","messagePattern":"No supported Office XML text entries were found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/server/src/opencode-plugins/openwork-office-attachments.ts","lineNumber":683,"sourceCode":"      lines.push(`      type: ${quoted(cell.type)}`);\n      if (cell.rawValue !== undefined) lines.push(`      raw_value: ${quoted(cell.rawValue)}`);\n      if (cell.displayedValue !== undefined) lines.push(`      displayed_value: ${quoted(cell.displayedValue)}`);\n      if (cell.formula) lines.push(`      formula: ${quoted(cell.formula)}`);\n      if (cell.formulaType) lines.push(`      formula_type: ${quoted(cell.formulaType)}`);\n      if (cell.formulaRef) lines.push(`      formula_ref: ${quoted(cell.formulaRef)}`);\n      if (cell.styleIndex !== undefined) lines.push(`      style_index: ${quoted(cell.styleIndex)}`);\n      if (cell.numberFormat) lines.push(`      number_format: ${quoted(cell.numberFormat)}`);\n    }\n    if (data.omittedCells > 0) lines.push(`    omitted_cells: ${data.omittedCells}`);\n  }\n  if (sheets.length > MAX_XLSX_SHEETS) lines.push(`  omitted_sheets: ${sheets.length - MAX_XLSX_SHEETS}`);\n  return lines.join(\"\\n\").slice(0, MAX_EXTRACTED_TEXT_CHARS);\n}\n\nfunction extractOfficeText(kind: OfficeKind, bytes: Buffer): string {\n  if (kind === \"xlsx\") return extractXlsxText(bytes);\n  const entries = listZipEntries(bytes).filter((entry) => relevantXmlEntry(kind, entry.name)).sort(compareEntryName);\n  if (entries.length === 0) throw new Error(\"No supported Office XML text entries were found.\");\n  const pieces: string[] = [];\n  let remaining = MAX_EXTRACTED_TEXT_CHARS;\n  for (const entry of entries) {\n    if (remaining <= 0) break;\n    const text = xmlText(readZipEntryData(bytes, entry).toString(\"utf8\"));\n    if (!text) continue;\n    const chunk = text.slice(0, remaining);\n    pieces.push(`[${entry.name}]\\n${chunk}`);\n    remaining -= chunk.length;\n  }\n  const combined = pieces.join(\"\\n\\n\").slice(0, MAX_EXTRACTED_TEXT_CHARS);\n  if (!combined) throw new Error(\"Office XML text entries contained no extractable text.\");\n  return combined;\n}\n\nfunction basePartIds(part: Record<string, unknown>): Record<string, unknown> {\n  const result: Record<string, unknown> = {};\n  for (const key of [\"id\", \"sessionID\", \"messageID\", \"sessionId\", \"messageId\"]) {","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/different-ai/openwork/blob/2b7df46e8ae1517d64c896c7793d2d52ec845669/apps/server/src/opencode-plugins/openwork-office-attachments.ts#L665-L701","documentation":"For docx/pptx (non-xlsx) extraction, extractOfficeText filters zip entries through relevantXmlEntry (e.g., word/*.xml, ppt/*.xml) and throws when no qualifying XML part exists. The file is either not the claimed Office kind or has no textual parts.","triggerScenarios":"extractOfficeText(\"docx\"|\"pptx\", bytes) on a zip with no entries ending in the relevant XML paths — renamed zip, wrong kind passed (e.g., docx bytes parsed as pptx), encrypted OOXML, or an archive missing its word//ppt/ parts.","commonSituations":"Renamed files (zip/html saved as .docx); passing the wrong OfficeKind to extractOfficeText; DRM/encrypted Office files; minimal OOXML containers with no document parts.","solutions":["Verify the OfficeKind passed matches the actual file type (docx vs pptx).","Confirm the zip contains word/document.xml or ppt/ XML parts (unzip -l).","Re-save the file from Word/PowerPoint as a standard .docx/.pptx.","Check the file isn't password-protected/encrypted (encrypted OOXML is an OLE container, not a zip with XML parts)."],"exampleFix":"// before: kind inferred from user-supplied label\nextractOfficeText(userKind, bytes);\n// after: detect kind from content\nconst kind = detectOfficeKind(bytes); // checks presence of word/ vs ppt/ parts\nextractOfficeText(kind, bytes);","handlingStrategy":"validation","validationCode":"function detectOfficeKind(bytes: Buffer): \"docx\" | \"pptx\" | \"xlsx\" | null {\n  if (bytes.includes(Buffer.from(\"word/document.xml\"))) return \"docx\";\n  if (bytes.includes(Buffer.from(\"ppt/presentation.xml\"))) return \"pptx\";\n  if (bytes.includes(Buffer.from(\"xl/workbook.xml\"))) return \"xlsx\";\n  return null;\n}","typeGuard":"function hasRelevantXmlParts(bytes: Buffer): boolean {\n  return bytes.includes(Buffer.from(\"word/\")) || bytes.includes(Buffer.from(\"ppt/\"));\n}","tryCatchPattern":"try {\n  const text = extractOfficeText(kind, bytes);\n} catch (err) {\n  if (err instanceof Error && err.message.includes(\"No supported Office XML text entries\")) {\n    throw new ApiError(400, \"invalid_office_file\", \"No readable document parts found; re-save the file from Office.\");\n  }\n  throw err;\n}","preventionTips":["Detect Office kind from archive contents instead of trusting file extensions or user labels.","Reject encrypted OOXML (OLE containers) before extraction.","Confirm required parts (word/document.xml, ppt/slides/) exist before calling.","Validate uploads are genuine OOXML at ingest time."],"tags":["office","docx","pptx","zip","missing-file"],"backgroundTag":"missing-required-archive-entry","analyzedSha":"2b7df46e8ae1517d64c896c7793d2d52ec845669","analyzedAt":"2026-09-01T07:59:23.713Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}