DOCXKIT_EXPORT_FAILED: Document export failed
Packaging the compiled document failed. The original cause remains available to the caller.
What to do
- Inspect error.cause locally to identify the failing resource.
- 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
code:EXPORT_FAILEDdiagnosticCode:DOCXKIT_EXPORT_FAILEDname:DocxKitErrordocs: https://docx-kit.ntnyq.dev/errors/docxkit_export_failed/
Example message
text
Failed to pack document to blob