Skip to content

DOCXKIT_EXPORT_FAILED: Document export failed ​

Packaging the compiled document failed. The original cause remains available to the caller.

What to do ​

  1. Inspect error.cause locally to identify the failing resource.
  2. Use an export format supported by the current platform and verify referenced resources.

Problem example ​

ts
// Packaging can fail when a referenced resource is invalid.
// Inspect the original cause at the export boundary.

Corrected example ​

ts
import { createDocx, DocxKitError, serializeDocxKitError } from 'docx-kit'

try {
  const blob = await createDocx().p('Hello').toBlob()
} catch (error) {
  if (error instanceof DocxKitError) {
    console.error(serializeDocxKitError(error))
    // Inspect error.cause locally when needed.
  } else {
    throw error
  }
}

Common causes ​

  • Invalid document resources or packaging failure.

Diagnostic fields ​

Example message ​

text
Failed to pack document to blob

Released under the MIT License.