FlowiseAI/Flowise · error · Error

Failed to parse PowerPoint file: ${error instanceof Error ?

Error message

Failed to parse PowerPoint file: ${error instanceof Error ? error.message : 'Unknown error'}

What it means

Thrown by PowerpointLoader.parse when officeparser's parseOfficeAsync rejects while extracting text from a PowerPoint Buffer. The message interpolates the officeparser error (or 'Unknown error' for non-Error throws), so the inner cause drives diagnosis. Note the original stack is dropped (no cause chaining).

Source

Thrown at packages/components/nodes/documentloaders/MicrosoftPowerpoint/PowerpointLoader.ts:57

                // Split content by common slide separators or use the entire content as one document
                const slides = this.splitIntoSlides(data)

                slides.forEach((slideContent, index) => {
                    if (slideContent.trim()) {
                        result.push({
                            pageContent: slideContent.trim(),
                            metadata: {
                                slideNumber: index + 1,
                                documentType: 'powerpoint',
                                ...metadata
                            }
                        })
                    }
                })
            }
        } catch (error) {
            console.error('Error parsing PowerPoint file:', error)
            throw new Error(`Failed to parse PowerPoint file: ${error instanceof Error ? error.message : 'Unknown error'}`)
        }

        return result
    }

    /**
     * Split content into slides based on common patterns
     * This is a heuristic approach since officeparser returns plain text
     */
    private splitIntoSlides(content: string): string[] {
        // Try to split by common slide patterns
        const slidePatterns = [
            /\n\s*Slide\s+\d+/gi,
            /\n\s*Page\s+\d+/gi,
            /\n\s*\d+\s*\/\s*\d+/gi,
            /\n\s*_{3,}/g, // Underscores as separators
            /\n\s*-{3,}/g // Dashes as separators
        ]

View on GitHub (pinned to abe4a8601a)

Solutions

  1. Verify the file is a genuine Office Open XML (.pptx) or supported legacy format — try opening it in PowerPoint/LibreOffice first.
  2. Re-upload the file to rule out truncation during upload.
  3. Remove password protection from the file before loading.
  4. Update the officeparser dependency to the latest version.
  5. Chain the cause when re-throwing: throw new Error('...', { cause: error }).

Example fix

// before
} catch (error) {
  console.error('Error parsing PowerPoint file:', error)
  throw new Error(`Failed to parse PowerPoint file: ${error instanceof Error ? error.message : 'Unknown error'}`)
}
// after - guard empty buffer and preserve cause
if (!raw || raw.length === 0) throw new Error('PowerPoint file is empty')
// ...
} catch (error) {
  throw new Error('Failed to parse PowerPoint file', { cause: error })
}
Defensive patterns

Strategy: validation

Validate before calling

// Cheap magic-byte check before handing the Buffer to officeparser
function looksLikeOffice(buf) {
  if (!buf || buf.length < 4) return false
  // ZIP (Office Open XML) local file header signature
  return buf[0] === 0x50 && buf[1] === 0x4b && (buf[2] === 0x03 || buf[2] === 0x05 || buf[2] === 0x07)
}
if (!looksLikeOffice(raw)) throw new Error('File is not a valid Office (ZIP-based) document')

Type guard

function isNonEmptyBuffer(b) { return Buffer.isBuffer(b) && b.length > 0 }

Try / catch

try {
  return await pptxLoader.parse(raw, metadata)
} catch (e) {
  if (/Failed to parse PowerPoint file/.test(e.message)) {
    throw new Error('PowerPoint file could not be parsed — check it is a valid, unencrypted .pptx', { cause: e })
  }
  throw e
}

Prevention

When it happens

Trigger: The uploaded file is not a valid .ppt/.pptx (e.g. renamed .pdf or .docx); the file is corrupt or truncated; the file is password-protected/encrypted; officeparser version mismatch or missing optional dependency; the Buffer is empty or zero-length.

Common situations: User uploads a file with the wrong extension; upload was interrupted leaving a partial file; legacy .ppt (binary) format unsupported by the officeparser build; very large file hitting a memory/timeout limit.

Understand the failure class

Related errors


AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12). Data as JSON: /api/errors/1cc9766219102207. Report an issue: GitHub.