Repository navigation
Description
System details
RStudio Edition : Desktop
RStudio Version : 2026.09.0+174 (rel-autumn-hawkbit, 870df5ed78)
OS Version : macOS 14 arm64 (GitHub Actions runner)
R Version : 4.1.3
Seen in CI rather than through interactive use, in the certification e2e run
https://github.com/rstudio/rstudio/actions/runs/34260015710 (cell
macOS 14 arm64 / e2e-desktop-macos14 (2)). It surfaced as an uncaught client
exception during tests/panes/files/files_date_format.test.ts, which is
incidental -- that spec changes a preference and the Source column reacts. This
is not a Files-pane or date-format bug.
The test passed on retry, and the same spec passed on the other nine cells.
Steps to reproduce the problem
No deterministic reproducer yet. The captured stack is unambiguous about how the
throwing frame was reached (symbols resolved with the GWT symbolMap from an
ant build at the same commit, and independently corroborated by reading the
shipped 663CCD2A66B850C6CC3EDA8577CAC600.cache.js):
TextEditingTargetWidget$7.run (TextEditingTargetWidget.java:993) document-outline latch Timer
SourceColumnManager.setActive (SourceColumnManager.java:516)
SourceColumn.setActiveEditor (SourceColumn.java:362)
SourceColumn.onActivate (SourceColumn.java:343)
SourcePane.selectTab (SourcePane.java:153)
TabLayoutPanel.selectTab (:711)
DocTabLayoutPanel.selectTab
HandlerManager.fireEvent / SimpleEventBus.doFire
SelectionEvent.dispatch
SourceColumn.onSelection (SourceColumn.java:1188) <-- throws
Reported to the client as:
Exception caught: (TypeError) : Cannot read properties of null (reading 'NN')
where NN is EditingTarget.getPath().
Describe the problem in detail
SourceColumn.onSelection assigns activeEditor_, makes two calls, and then
dereferences the field again:
activeEditor_ = editors_.get(event.getSelectedItem()); // 1197
activeEditor_.onActivate(); // 1198
manager_.setActive(name_); // 1199
// let any listeners know this tab was activated
events_.fireEvent(new DocTabActivatedEvent( // 1202
activeEditor_.getPath(), // 1203 <-- NPE
activeEditor_.getId()));activeEditor_ cannot have been null at 1198 -- onActivate() would have
thrown first -- so it was nulled between 1198 and 1203, i.e. by something one
of those two calls re-entered. Three statements in the class null the field:
SourceColumn.onSelection:1193-- a re-entrant selection whose
getSelectedItem() < 0would leave it null on return.SourceColumn.setActiveEditor(String):376-- nulls it when handed an empty
docId.SourceColumnManager.setActive(SourceColumn):526calls
prevColumn.setActiveEditor("")on exactly that path.SourceColumn.removeTab(around :1397), on the close path.
The stack does not name which one, because the culprit frame had already
returned by the time line 1203 ran. That is the one open question here.
Re-entrancy is structurally easy to reach: SourceColumn.onActivate:358 calls
display_.selectTab(...), which fires a selection event synchronously, and
onSelection in turn calls back into SourceColumnManager.setActive. The
field is live across all of it.
How likely is this in practice
The trigger is common but the window is narrow.
- The entry point is the
new Timer()inTextEditingTargetWidget(:989-:993,
commented "Time-out setting the latch just to ensure the document outline has
actually been appropriately rendered"), which runs on source-document widget
construction. Opening a document is among the most frequent things a user
does. - Landing in the fault needs that timer to fire while a column/tab selection is
mid-flight and something nullsactiveEditor_inside a two-statement window.
Being timer-driven, it is load-dependent -- it showed up on the slowest,
most network-degraded cell in the run and nowhere else. - Multiple source columns make the
prevColumn != activeColumn_branch (and so
thesetActiveEditor("")null) reachable in normal use.
So: rare per action, attached to very frequent actions, and more likely on
loaded machines. Expect it at fleet scale rather than in a given session.
Consequences
The throw happens inside event dispatch, so it is caught by GWT's uncaught
handler and does not crash the IDE. The cost is that DocTabActivatedEvent is
never fired for that activation, and the remainder of onSelection -- including
the deferred focus block after :1203 -- never runs. Its three consumers:
SourceColumnManager:297->setActiveDocId(event.getId()). The manager's
notion of the active document goes stale.SourceWindowManager:874->server_.chatDocFocused(event.getId(), ...),
which exists (per its own comment) so Posit Assistant'sinsertAtCursor
works when documents are activated without getting focus. Missing it means
the Assistant can target the wrong document.DocsMenu:57->refreshStyles(event.getId()). The Docs menu keeps stale
active-document styling.
The user-visible shape is therefore a tab that activates without taking
keyboard focus, a stale Docs menu, and -- the one with real blast radius -- an
Assistant insertion that can land in the wrong file.
Suggested direction
Hold the editor in a local and use it for the event, so a re-entrant call
cannot pull it out from under the rest of the method:
EditingTarget editor = editors_.get(event.getSelectedItem());
activeEditor_ = editor;
editor.onActivate();
manager_.setActive(name_);
events_.fireEvent(new DocTabActivatedEvent(editor.getPath(), editor.getId()));That removes the crash. Whether the re-entrancy itself should be prevented, and
which of the three nulling statements is firing, is worth settling first --
answering it may show the same pattern in the sibling reads of activeEditor_
in this class.
Diagnosability note
Resolving this needed a local ant build at the matching commit to get a
GWT symbolMap, because obfuscated CI stacks are otherwise unreadable.
src/gwt/build.xml:371 already writes symbolMaps to src/gwt/extras, and
:557 deletes them on clean. Publishing that directory as a build artifact
would make future obfuscated stacks resolvable without reproducing the build.
Activity
gtritchie commentedon Sep 8, 2026
Not a regression — the crash is ~5 years old, but its blast radius is new
Worth recording so nobody triages this as a recent regression. Dates are from
git blame/git logon this checkout.activeEditor_ = null+ thegetSelectedItem() >= 0guard (initial-import boundary)TimerinTextEditingTargetWidgetfireEvent(new DocTabActivatedEvent(activeEditor_.getPath(), ...))activeEditor_.onActivate()inserted between the assignment and the deref (6e59b22c153)manager_.setActive(name_)added inside the window (eff0599412d)prevColumn.setActiveEditor("")insetActive(SourceColumn)(0ebfc95323f)SourceWindowManager.onDocTabActivated->chatDocFocused(aedee17618b)Before 2020-04-21 the field was assigned and dereferenced with no call-out in
between, so there was no re-entrancy window at all. Everything that opened and
widened it is the multi-column Source work --
c363e9f673cand97eddbe8a25("pull logic from Source to create a SourceColumn class and SourceColumnManager
class...") -- which shipped in RStudio 1.4. The code moved
Source.java->SourcePane.java->SourceColumn.javaacross that refactor,which is why blame on the current file only reaches 2020.
The genuinely new piece is the Assistant handler, added 2025-12-16. Before it, a
missed
DocTabActivatedEventcost a stale Docs menu and a staleactiveDocId.Now it also means Posit Assistant is not told which document is focused, so
insertAtCursorcan target the wrong file. In other words: old crash, newconsequence.
Two limits on this analysis:
crash telemetry was consulted, so it may have been happening rarely for years.
The e2e uncaught-client-exception capture landed 2026-06-12; an exception like
this is swallowed by GWT's uncaught handler and would not have failed a test
before that.
Fix stale source column activation (#18736) (#18737)