Skip to content

Fix dropped error hints and improve error output UI#9673

Merged
akshayka merged 6 commits into
mainfrom
fix-error-output-ui
May 27, 2026
Merged

Fix dropped error hints and improve error output UI#9673
akshayka merged 6 commits into
mainfrom
fix-error-output-ui

Conversation

@akshayka

@akshayka akshayka commented May 22, 2026

Copy link
Copy Markdown
Contributor

This change improves how statically parsed errors and exceptions are rendered in marimo's frontend, making them more compact, more legible, and conveying more information.

Motivation. Reactive notebooks can emit many errors. Our errors were taking up a lot of space (padding, redundant information), reducing information density. They were also a bit aggressively red in their styling, especially static errors such as multiple definition errors, which can make users feel alarmed or stressed.

Changes. Python's "Did you mean: ..." suggestions for NameError, AttributeError, and similar exceptions were never reaching the frontend; this change fixes that.

The rest of the change tidies how errors are presented, making them more compact and legible. The console-area traceback loses its collapsible accordion, which only repeated the exception message already shown above it. The output area loses its "See console area for traceback", unless outputs are configured to be shown above the cell.

Static errors (multiple definitions, cycles, setup-cell references, star imports) no longer include the aggressive red "This cell wasn't run because it has errors text". Instead, a subtle cell not run title is included, with a tooltip provided more context.

Examples

Multiple definition error.

image

With tooltip.

image

Exceptions.

image

This change improves how statically parsed errors and exceptions
are rendered in marimo's frontend, making them more compact,
more legible, and conveying more information.

Python's "Did you mean: ..." suggestions for NameError, AttributeError,
and similar exceptions were never reaching the frontend; this change
fixes that.

The rest of the change tidies how errors are presented, making them more
compact and legible. The console-area traceback loses its collapsible
accordion, which only repeated the exception message already shown above it.
The output area loses its "See console area for traceback", unless outputs
are configured to be shown above the cell.

Static errors (multiple definitions, cycles, setup-cell
references, star imports) no include the aggressive red "This cell wasn't
run because it has errors text". Instead, a subtle cell not run title
is included, with a tooltip provided more context.
Copilot AI review requested due to automatic review settings May 22, 2026 22:30
@vercel

vercel Bot commented May 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment May 27, 2026 5:23pm

Request Review

Copilot AI left a comment

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.

Pull request overview

This pull request improves how exceptions and statically parsed errors are surfaced end-to-end: it preserves Python’s “Did you mean: …” hints in backend error messages and adjusts the frontend error/traceback UI to be more compact and less visually aggressive.

Changes:

  • Preserve Python exception “Did you mean: …” suggestions by formatting exception messages via traceback.TracebackException and using this in post-execution error broadcasting.
  • Update frontend traceback/error rendering to reduce redundancy (remove traceback accordion header, conditionally show “See console area…” hint, add a subtle “Cell not run” overline for static errors).
  • Tweak error-related styling (reduced red emphasis in cell outlines and active error line highlighting).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/_runtime/test_runtime.py Adds runtime regression test for NameError suggestion propagation.
tests/_messaging/test_tracebacks.py Adds unit tests for format_exception_message() behavior.
marimo/_runtime/runner/hooks_post_execution.py Uses format_exception_message() when constructing exception error payloads.
marimo/_messaging/tracebacks.py Introduces format_exception_message() using TracebackException to retain hints.
frontend/src/css/app/Cell.css Softens cell error outline styling by removing red background fill.
frontend/src/core/codemirror/cells/traceback-decorations.ts Adjusts focused error-line highlight color intensity.
frontend/src/components/editor/output/MarimoTracebackOutput.tsx Simplifies traceback display by removing the accordion header/collapse UI.
frontend/src/components/editor/output/MarimoErrorOutput.tsx Conditionally shows console hint, adds “Cell not run” overline + tooltip for static errors, tightens spacing.

Comment thread tests/_runtime/test_runtime.py Outdated
Comment thread tests/_messaging/test_tracebacks.py Outdated
Comment thread marimo/_messaging/tracebacks.py Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

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.

1 issue found across 8 files

Architecture diagram
sequenceDiagram
    participant Client as Client Browser
    participant Editor as CodeMirror Editor
    participant Component as MarimoErrorOutput
    participant Traceback as MarimoTracebackOutput
    participant FrontendConfig as Frontend Config Store
    participant Kernel as Python Kernel
    participant TracebackModule as Traceback Module
    participant PostExec as Post-Execution Hook

    Note over Client,PostExec: Error display flow with improved hints and compact UI

    Client->>Kernel: Execute cell
    Kernel->>PostExec: on cell result (exception)
    PostExec->>TracebackModule: format_exception_message(exception)
    Note over PostExec,TracebackModule: NEW: Uses TracebackException to preserve Python's "Did you mean: ..." hints
    TracebackModule-->>PostExec: Formatted message with suggestions
    PostExec->>Client: Broadcast error (exception_type, msg, traceback)

    Client->>Component: Render error output
    Component->>FrontendConfig: Read cell_output display config
    FrontendConfig-->>Component: "above" or "below"

    alt Static error (multiple-defs, cycle, setup-refs, import-star)
        Note over Component: NEW: No alert title, only status overline
        Component->>Component: Show "Cell not run" overline
        Component->>Component: Show tooltip on InfoIcon
        Component->>Component: Render body message (already describes error)
        Component-->>Client: Compact error display (reduced padding/spacing)
    else Runtime exception
        Component->>Component: Show exception type & formatted message
        alt Console traceback present
            Component->>Component: Render formatted traceback HTML
        else No traceback
            opt showConsoleHint is true (output above cell)
                Component->>Component: Show "See console area for traceback"
            end
        end
        Component->>Component: Show action buttons (copy, search, AI fix, cell link)
        Component-->>Client: Error display (reduced vertical spacing, no accordion)
    else Ancestor/other errors
        Component->>Component: Show descriptive title (changed colors)
        Component-->>Client: Error display
    end

    Note over Client,Traceback: CHANGED: Traceback output no longer wrapped in accordion
    Client->>Traceback: Render traceback
    Traceback->>Traceback: Format traceback (highlight, link cells, add replacements)
    Traceback-->>Client: Direct display (no collapse/expand, no redundant header)

    Note over Editor,Component: Editor styling improvements
    Client->>Editor: Apply error line decorations
    Editor->>Editor: NEW: Reduced background opacity (red-5 instead of red-6)
    Editor-->>Client: Error line styling (less aggressive highlight)

    Note over Client: Cell container styling
    Client->>Client: NEW: Remove red-2 background from error-outline cells
    Client-->>Client: Cell still has error shadow but no background tint
Loading

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread marimo/_messaging/tracebacks.py Outdated
@akshayka akshayka added the enhancement New feature or request label May 22, 2026

@dmadisetti dmadisetti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

For posterity this is what it currently looks like:

Image Image

I thought we maybe mentioned automatically collapsing the stacktrace and just putting the error? I think a collapsable stack track still may make sense (see below for an extreme example)

Image

Aside from that, I think this is nice!

@akshayka

Copy link
Copy Markdown
Contributor Author

I don't think we should collapse stacktraces, they are valuable information

@akshayka

Copy link
Copy Markdown
Contributor Author

Thanks @dylan. I've made the traceback collapsible, thank you for catching that regression.

image

@dmadisetti dmadisetti left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nice

@akshayka
akshayka merged commit 44638a5 into main May 27, 2026
44 checks passed
@akshayka
akshayka deleted the fix-error-output-ui branch May 27, 2026 21:12
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.23.9-dev11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants