BookStackApp/BookStack · error · Error
Failed to save image with error: ${err}
Error message
Failed to save image with error: ${err} What it means
Wrapping error thrown in the TinyMCE drawio plugin's updateContent when saving the rendered diagram via DrawIO.upload fails; an image-upload error event is shown to the user and the underlying cause is rethrown embedded in the message. Typically a network or server-side upload failure.
Source
Thrown at resources/js/wysiwyg-tinymce/plugin-drawio.js:60
} else {
window.$events.emit('error', options.translations.imageUploadErrorText);
}
console.error(error);
};
// Handle updating an existing image
if (currentNode) {
DrawIO.close();
const imgElem = currentNode.querySelector('img');
try {
const img = await DrawIO.upload(pngData, options.pageId);
pageEditor.undoManager.transact(() => {
pageEditor.dom.setAttrib(imgElem, 'src', img.url);
pageEditor.dom.setAttrib(currentNode, 'drawio-diagram', img.id);
});
} catch (err) {
handleUploadError(err);
throw new Error(`Failed to save image with error: ${err}`, {cause: err});
}
return;
}
await wait(5);
const id = `drawing-${Math.random().toString(16).slice(2)}`;
const wrapId = `drawing-wrap-${Math.random().toString(16).slice(2)}`;
pageEditor.insertContent(`<div drawio-diagram contenteditable="false" id="${wrapId}"><img src="${loadingImage}" id="${id}"></div>`);
DrawIO.close();
try {
const img = await DrawIO.upload(pngData, options.pageId);
pageEditor.undoManager.transact(() => {
pageEditor.dom.setAttrib(id, 'src', img.url);
pageEditor.dom.setAttrib(wrapId, 'drawio-diagram', img.id);
});
} catch (err) {View on GitHub (pinned to 18f8469a1c)
Solutions
- Check network connectivity and the server's image upload endpoint
- Verify upload size limits and authentication/CSRF state
- Inspect the embedded err for the underlying failure status
- Retry the draw.io save after the transport issue is fixed
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at resources/js/wysiwyg-tinymce/plugin-drawio.js:60 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of BookStackApp/BookStack@18f8469a1c (2026-09-02).
Data as JSON: /api/errors/9f38d0ffbb394127.
Report an issue: GitHub.