Skip to content

Console error "Show Traceback" link does not change to "Hide Traceback" #19645

Closed

Description

@gtritchie

On a Console error, clicking "Show Traceback" shows the call list, but the link keeps saying "Show Traceback" when it should say "Hide Traceback". Reproduced on RStudio Server built from main (8df4792) with R 4.6.2 and default settings.

ConsoleError.setTracebackVisible() (ConsoleError.java) only looks at the error box's direct child elements:

NodeList<Node> children = this.getElement().getChildNodes();
...
if (child.hasClassName("show_traceback_text")) {
   ... child.setInnerText(constants_.hideTracebackText()) ...
}
else if (child.hasClassName("stack_trace")) { ... }

stack_trace is a direct child, so the traceback is shown and hidden. show_traceback_text is two levels further down, inside the commands panel (ConsoleError.ui.xml), so the loop never reaches it and its text never changes.

This probably started in a052bdd (first in 2021.09.0). That commit replaced showTracebackText.setText(...) with walking the DOM, to work with the virtual scroller's raw-JavaScript handling of Console output. A fix probably needs to search the whole subtree (for example, querySelector(".show_traceback_text") on the error element) rather than go back to the @UiField.

Steps to reproduce

  1. Run this in the Console:

    g <- function() stop("boom"); f <- function() g(); f()
  2. Click "Show Traceback" in the error box.

Expected: the call list appears and the link says "Hide Traceback".
Actual: the call list appears, but the link still says "Show Traceback". Clicking it again hides the list, so the toggle works and only the label is wrong.

A top-level stop("boom") isn't a useful repro. With the default setting (traceback for user code only), RStudio sends no traceback when there are fewer than two calls (SessionErrors.R, recordTraceback), so the list is empty and nothing visibly changes.

Activity

  1. added theissue type on Nov 16, 2026
  2. changed the title [-]Console error "Show Traceback" link may not change to "Hide Traceback"[/-] [+]Console error "Show Traceback" link does not change to "Hide Traceback"[/+] on Nov 16, 2026
  3. self-assigned this
    on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions