DOCXKIT_IMAGE_INVALID_DATA: Invalid image data
Image content is empty, cannot be identified, or requires a path resolver.
What to do
- Supply supported non-empty image bytes or a data URL.
- For file paths use docx-kit/node; in browsers configure resolveImage.
- Check imageType when automatic format detection is unavailable.
Problem example
ts
import { createDocx } from 'docx-kit'
await createDocx().image({ data: '' }).toBlob()Corrected example
ts
import { createDocx } from 'docx-kit'
const data = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+aX1cAAAAASUVORK5CYII='
const blob = await createDocx().image({ data }).toBlob()Common causes
- Empty image data, unsupported format, or an unresolved path.
Diagnostic fields
code:IMAGE_INVALID_DATAdiagnosticCode:DOCXKIT_IMAGE_INVALID_DATAname:DocxKitErrordocs: https://docx-kit.ntnyq.dev/errors/docxkit_image_invalid_data/
Example message
text
Image data is empty or null