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 updateDrawingNodeFromData when saving the rendered diagram PNG via DrawIO.upload fails; HttpError upload failures are surfaced to the user first (handleUploadError), then the error is rethrown with the cause embedded. Root causes are network/server errors or a new-node cleanup path after failed upload.

Source

Thrown at resources/js/wysiwyg/utils/diagrams.ts:60

    }

    try {
        const img = await DrawIO.upload(pngData, context.options.pageId);
        context.editor.update(() => {
            node.setDrawingIdAndUrl(String(img.id), img.url);
        });
    } catch (err) {
        if (err instanceof HttpError) {
            handleUploadError(err, context);
        }

        if (isNew) {
            context.editor.update(() => {
                node.remove();
            });
        }

        throw new Error(`Failed to save image with error: ${err}`);
    }
}

export function $openDrawingEditorForNode(context: EditorUiContext, node: DiagramNode): void {
    let isNew = false;
    DrawIO.show(context.options.drawioUrl, async () => {
        const drawingId = await loadDiagramIdFromNode(context.editor, node);
        isNew = !drawingId;
        return isNew ? '' : DrawIO.load(drawingId);
    }, async (pngData: string) => {
        return updateDrawingNodeFromData(context, node, pngData, isNew);
    });
}

export function showDiagramManager(callback: (image: EditorImageData) => any) {
    const imageManager: ImageManager = window.$components.first('image-manager') as ImageManager;
    imageManager.show((image: EditorImageData) => {
        callback(image);

View on GitHub (pinned to 18f8469a1c)

Solutions

  1. Check network connectivity and server image-upload endpoint availability
  2. Inspect the embedded err for the underlying HttpError status
  3. Verify upload file-size limits and CSRF/auth state on the server
  4. Retry saving the drawing after resolving the transport issue
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at resources/js/wysiwyg/utils/diagrams.ts: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/877f009df736257c. Report an issue: GitHub.