Skip to content

Add warning log when repr_mimebundle fails#9199

Merged
Light2Dark merged 1 commit intomainfrom
sham/add-log-warning
Apr 15, 2026
Merged

Add warning log when repr_mimebundle fails#9199
Light2Dark merged 1 commit intomainfrom
sham/add-log-warning

Conversation

@Light2Dark
Copy link
Copy Markdown
Collaborator

@Light2Dark Light2Dark commented Apr 15, 2026

📝 Summary

We swallowed errors when imports were not installed / configurations were incorrect when rendering altair charts. This can lead to user confusion because their settings were not being respected.

I noticed this when testing #9104 and did not have vl-convert-python installed.

I'm hoping this isn't too noisy, I've tried several altair notebooks.
image

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes (optional).

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

Copilot AI review requested due to automatic review settings April 15, 2026 04:30
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Apr 15, 2026 4:30am

Request Review

@Light2Dark Light2Dark added the bug Something isn't working label Apr 15, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds logging to surface Altair chart rendering issues that were previously silently ignored when _repr_mimebundle_() fails (e.g., missing vl-convert-python or misconfiguration), improving debuggability in the output formatting pipeline.

Changes:

  • Log a warning when chart._repr_mimebundle_() raises an exception during Altair formatting.

except Exception:
pass
except Exception as e:
LOGGER.warning("Failed to get mimebundle from chart: %s", e)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

traceback might be noisy

Comment on lines 48 to +52
mimebundle: MimeBundle | tuple[MimeBundle, MimeBundle] = {}
try:
mimebundle = chart._repr_mimebundle_() or {} # type: ignore
except Exception:
pass
except Exception as e:
LOGGER.warning("Failed to get mimebundle from chart: %s", e)
@Light2Dark Light2Dark merged commit 93aab37 into main Apr 15, 2026
54 of 55 checks passed
@Light2Dark Light2Dark deleted the sham/add-log-warning branch April 15, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants