Skip to content

Add option to display error tracebacks inline and in modal#8376

Open
wlach wants to merge 2 commits intomarimo-team:mainfrom
wlach:marimo-error-run-mode-modal
Open

Add option to display error tracebacks inline and in modal#8376
wlach wants to merge 2 commits intomarimo-team:mainfrom
wlach:marimo-error-run-mode-modal

Conversation

@wlach
Copy link
Contributor

@wlach wlach commented Feb 19, 2026

📝 Summary

Closes #7984

🔍 Description of Changes

Add an optional mode (disabled by default) to display error tracebacks both inline and in a modal when in run (app) mode. This makes it easier for users to report errors in internal environments.

📋 Checklist

  • I have read the contributor guidelines.
  • 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).
  • Tests have been added for the changes made.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Pull request title is a good summary of the changes - it will be used in the release notes.

@vercel
Copy link

vercel bot commented Feb 19, 2026

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

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview, Comment Feb 19, 2026 7:16pm

Request Review

@github-actions github-actions bot added the bash-focus Area to focus on during release bug bash label Feb 19, 2026
@wlach
Copy link
Contributor Author

wlach commented Feb 19, 2026

@akshayka @manzt per discussion, would love some feedback. Currently lacking docs, happy to try my hand at adding some.

@dmadisetti dmadisetti added the enhancement New feature or request label Feb 19, 2026
@Light2Dark Light2Dark requested review from akshayka and removed request for Light2Dark February 21, 2026 12:52
@akshayka akshayka requested review from dmadisetti and removed request for dmadisetti February 25, 2026 23:50
Copy link
Contributor

@akshayka akshayka left a comment

Choose a reason for hiding this comment

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

A couple comments on the API

help="Custom asset URL for loading static resources. Can include {version} placeholder.",
)
@click.option(
"--show-error-tracebacks/--no-show-error-tracebacks",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"--show-error-tracebacks/--no-show-error-tracebacks",
"--show-tracebacks/--no-show-tracebacks",

Comment on lines +172 to +174
- `show_error_tracebacks`: if `True`, show detailed error tracebacks in run mode.
When enabled, exceptions will display a clickable toast that opens a modal with the full traceback.
The default is `True`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be in config? This isn't really a runtime configuration in my mind. The console redirection is also not in config

Copy link
Collaborator

@manzt manzt left a comment

Choose a reason for hiding this comment

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

Thanks for pushing this forward.

I'm convinced separating console redirection from tracebacks is the right call. They serve different purposes (as you mentioned), so keeping them independent makes sense.

+1 to removing from config. redirect_console_to_browser is CLI/ASGI-only and this should follow the same pattern. Keeping it out of config also gives us room to easily evolve the API later (if ever):

--show-tracebacks          # bare flag, sensible default
--show-tracebacks=toast
--show-tracebacks=inline

Not needed in this PR, just flagging that staying out of config preserves that optionality.

Comment on lines +80 to 82
const exceptionErrors = cell.output.data.filter(
(error: any) => error.type === "exception" || error.type === "internal",
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe we can remove the explicit any with type narrowing:

Suggested change
const exceptionErrors = cell.output.data.filter(
(error: any) => error.type === "exception" || error.type === "internal",
);
const exceptionErrors = cell.output.data.filter(
(error) =>
"type" in error &&
(error.type === "exception" || error.type === "internal"),
);


// Find first error with a traceback
const errorWithTraceback = exceptionErrors.find(
(error: any) => error.traceback,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think with changes above this can be removed (type is inferred).

Comment on lines +88 to +90
const errorWithTraceback = exceptionErrors.find(
(error: any) => error.traceback,
);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think with changes above this can be removed (type is inferred).

Suggested change
const errorWithTraceback = exceptionErrors.find(
(error: any) => error.traceback,
);
const errorWithTraceback = exceptionErrors.find(
(error) => error.traceback,
);

@wlach
Copy link
Contributor Author

wlach commented Feb 27, 2026

Thanks all! Very reasonable requests for changes, I'll try to find some time to polish this up next week.

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

Labels

api-change bash-focus Area to focus on during release bug bash enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow tracebacks to be exposed to users in deployed apps

5 participants