Skip to content

Support opt-in cell error display in static HTML exported with --no-include-code #11065

Description

@atsushimoroda

Description

When a notebook with a failing cell is exported with marimo export html --no-include-code, the failed cell and any cell that fails because of it are not rendered in the browser at all. Successful outputs before and after them render normally, so a distributed report can look complete even though part of it failed.

The CLI reports the failure correctly (exit status 1, see below), which helps whoever runs the export, but readers of the HTML cannot see it.

The static HTML documentation notes that a generated export may contain the error. In this reproduction, the error is present in the embedded session snapshot, but it is not visible in the browser when --no-include-code is
used:

{"ename": "exception", "evalue": "intentional export error", "traceback": null, "type": "error"}

The dependent cell's ancestor error is serialized the same way. The serialized evalue is the original exception message, so the information needed for a short, code-free error display is already in the file.

I understand that --no-include-code intentionally clears source code and console output (including tracebacks), and I am not asking to change that default.

Reproduction

repro.py:

import marimo

app = marimo.App()


@app.cell
def _():
    "before error"
    return


@app.cell
def _():
    failing_value = 10
    raise ValueError("intentional export error")
    return (failing_value,)


@app.cell
def _(failing_value):
    failing_value + 1
    return


@app.cell
def _():
    "after error"
    return


if __name__ == "__main__":
    app.run()
marimo export html repro.py -o repro.debug.html
marimo export html --no-include-code repro.py -o repro.html

Both export commands produced the following CLI output and exited with
status code 1:

MarimoExceptionRaisedError: intentional export error
MarimoExceptionRaisedError: An ancestor raised an exception (ValueError):
Error: Export was successful, but some cells failed to execute.
  • repro.debug.html renders 'before error', the failing cell (message +
    traceback), the dependent cell (ancestor error), and 'after error'.
  • repro.html renders only 'before error' and 'after error'. There is
    no error box, placeholder, or warning.

Screenshots:

  • repro.jpeg: Image
  • repro.debug.jpeg: Image

Suggested solution

The primary request is persistent failure visibility, not traceback disclosure.

Please add an opt-in for HTML export that keeps failures visible while source code remains hidden. Any of the following would satisfy this use case:

  • render the serialized evalue at the failed cell's position, e.g.

    This cell failed to execute.
    intentional export error

  • render a generic placeholder, e.g. for dependent cells

    This output is unavailable because an upstream cell failed.

  • show a persistent document-level warning, e.g.

    This report contains one or more cell execution errors.

A full traceback is not required; exporting with code already covers diagnostics.

The exact interface is up to the maintainers. One possible CLI design would be:

marimo export html --no-include-code --show-errors repro.py -o repro.html

marimo run already provides --show-tracebacks and runtime.show_tracebacks as opt-in mechanisms for displaying detailed exception information that is hidden by default in run mode. Reusing or extending that configuration may give a consistent user experience, but a separate, sanitized export setting may also be more appropriate.

Environment

  • OS: Windows 11
  • Python: 3.13
  • Browser: Microsoft Edge 154.0.4258.37
  • marimo: 0.25.0

Are you willing to submit a PR? (You must receive approval from the team before submitting a PR.)

  • Yes

Alternatives

  • Export with code included. This shows errors but exposes source code.
  • Check the exit status in CI and avoid publishing the HTML on failure.
    This is what I do now, but it does not help when a report with failures is intentionally shared, or when the HTML is distributed separately from the CI log.

Additional context

  • Related but not a duplicate: No Failure Hints When Using marimo export html #3089 added the non-zero exit status and CLI error output for failed exports. That works as expected here.
  • In marimo run, the same notebook initially shows a transient "An internal error occurred" toast. marimo run already provides
    --show-tracebacks for opting into detailed error information. No change to marimo run is requested by this issue.
  • Reproduced with the repro.py above on marimo 0.25.0, and with an equivalent .py notebook on 0.24.2. First noticed with a .qmd notebook on 0.24.0, so it is not specific to Quarto/QMD.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions