Chart PNG export fails in DOCX - kaleido requires Chrome

Resolved 💬 4 comments Opened Dec 22, 2025 by nimar2 Closed Feb 14, 2026

Problem

Charts created with create_visualization cannot be embedded as PNG images in DOCX exports. The export fails silently, leaving placeholder text like [Chart bb0e4261: Error exporting - ].

Root Cause

Kaleido (used by Plotly for image export) requires Chrome/Chromium:

  • Kaleido 1.x: Requires external Chrome installation
  • Kaleido 0.x: Bundles Chromium but fails in containers due to sandbox issues

Error Details

Kaleido requires Google Chrome to be installed.
Either download and install Chrome yourself following Google's instructions,
or install it from your terminal by running: $ plotly_get_chrome

When using kaleido 0.x with --no-sandbox:

Check failed: sandbox::ThreadHelpers::IsSingleThreaded()

What Works

  • ✅ Charts are created and saved to S3 (chart-data/{id}.json)
  • ✅ Chart HTML files are served at /c/{chart_id}
  • ✅ Charts display correctly in web browser
  • ❌ PNG export for DOCX/PDF/PPTX embedding fails

Attempted Solutions

  1. Kaleido <1.0 with --no-sandbox - Fails under QEMU emulation, sandbox check happens before args are processed
  2. Kaleido >=1.0 with chromium apt package - Debian apt mirror hash mismatch issues during Docker build
  3. Adding Chromium system dependencies - Same mirror issues

Potential Solutions

  1. Use a base image with Chrome pre-installed (e.g., playwright image)
  2. Install Chrome via official Google repos instead of Debian repos
  3. Use a Lambda/serverless function to render charts to PNG
  4. Pre-render PNG at chart creation time and store in S3
  5. Use matplotlib as fallback for simple chart types

Current Workaround

When PNG export fails, show chart URL instead:

[Chart bb0e4261: View at https://api.savvy-mcp.com/c/bb0e4261]

Files Involved

  • src/savvy/customization/tools.py - DOCX export code (lines 654-684)
  • src/savvy/visualization/tools.py - Chart creation
  • Dockerfile - System dependencies

Priority

Medium - Charts work in web view, only DOCX/PDF embedding affected.

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗