You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Session watcher also works with R 4.6.0 and later.
Screenshots
-
Environment (please complete the following information):
OS: Linux (Debian 13)
code-server Version: 4.117.0
aka Code Version 1.117.0
R Version: 4.6.0
vscode-R version: 2.8.8
Additional context
R version 4.6.0 (2026-04-24) -- "Because it was There"
Copyright (C) 2026 The R Foundation for Statistical Computing
Platform: aarch64-unknown-linux-gnu
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> .vsc.attach()
Error in .vsc.attach() : could not find function ".vsc.attach"
Having the same problem.
I found a workaround looking at ~/.vscode/extensions/reditorsupport.r-2.8.8/R/session/init.R code. It seems like the code is correctly sourced and functions are attached, but the new .First.sys() is never called. Running it in the R console will attach the R session.
For me this is good enough as a workaround for the moment.
Reacted by Garrett Catlin, Josh Park, skadi, Louis Lacoste, Martin Morlot, Víctor Granda, Chun-Jie Liu, Yao Xiong, Daniel Sabanes Bove, Shangxian Chen and 3 more
Good point @benz0li cc @bsirak
It seems that it now works as documented (See ?Startup).
Currently, vscode-R behaves in a way that depends on the implementation details and does not adhere to the correct specifications.
Should use .First() instead of .First.sys().
The weirdest thing just happened: I was perusing google after experiencing this issue and noticed this VSCode Extension hiding in the interwebs: https://github.com/WahiduzzamanKhan/rig-manager-vscode, and somehow, my problem went away. I mainly just wanted to install this extension first just for kicks:
I had my project R profile and home dir R profile like this:
Had the same issue after updating R from 4.5.2 to 4.6.0. .vsc.attach() could not be found anymore.
The root cause is that R 4.6.0 no longer calls .First.sys() during startup. The extension's init.R relies on overwriting .First.sys to initialize the session watcher, so the attach function never gets defined.
Fix that worked for me (in init.R of the extension, for me located at ~/.windsurf/extensions/reditorsupport.r-2.8.8-universal/R/session/init.R):
After restarting the R terminal everything attaches correctly again. This should probably be patched in the extension since R 4.6.0 deprecated .First.sysentirely.
Reacted by praharaaa, Caleb Scutt, Nur Banu Simsek, xklong1202, eeca1, guduxy, Hin-Tai Lam, Daniel I. Avila-Ortega, Louis Lacoste, Felipe Schafhauser Lubke and 6 more
The .First.sys() fix is working for me too but I was unable to implement it in .Rprofile. Waiting on a more permanent solution. Thanks all!
What do you mean by "unable to implement it in .Rprofile". Whats happening and what would you expect?
I tried to put the ".First.sys()" into .Rprofile so that it would run when an active R terminal was opened in VS code without me manually typing and setting it, but it didn't register. I am still writing it into the terminal for it to attach.
Activity
benz0li commentedon Apr 27, 2026
R 4.6.0 causes radian to crash on startup:
benz0li commentedon Apr 28, 2026
Ping @randy3k
MalditoBarbudo commentedon Apr 29, 2026
@benz0li
Having the same problem.
I found a workaround looking at
~/.vscode/extensions/reditorsupport.r-2.8.8/R/session/init.Rcode. It seems like the code is correctly sourced and functions are attached, but the new.First.sys()is never called. Running it in the R console will attach the R session.benz0li commentedon Apr 29, 2026
A similar problem was reported for arf:
.First()and.First.sys()are bypassed during the startup sequence eitsupi/arf#158Skolmeister commentedon Apr 29, 2026
Good call @MalditoBarbudo, I edited my
.Rprofileto call the function explicitely and now it works without manual interference:For me this is good enough as a workaround for the moment.
eitsupi commentedon Apr 29, 2026
Good point @benz0li cc @bsirak
It seems that it now works as documented (See
?Startup).Currently, vscode-R behaves in a way that depends on the implementation details and does not adhere to the correct specifications.
Should use
.First()instead of.First.sys().TinasheMTapera commentedon Apr 30, 2026
The weirdest thing just happened: I was perusing google after experiencing this issue and noticed this VSCode Extension hiding in the interwebs: https://github.com/WahiduzzamanKhan/rig-manager-vscode, and somehow, my problem went away. I mainly just wanted to install this extension first just for kicks:
brewversion of R:brew uninstall Rrig:brew tap r-lib/rig && brew install --cask rigrig add 4.5 && rig list && rig switch 4.5-arm64Someone smarter than me might be able to use this info!
Edit: still not perfect as the session hasn't fully "attached," but it's a little better:
randy3k commentedon May 2, 2026
I am working on the 3.0.0 release,
3.0.0-rc1 can be find at https://github.com/REditorSupport/vscode-R/releases/tag/latest
it should fix this issue.
MartinMorlot commentedon May 18, 2026
I attempted building the extension, did not resolve the issue, maybe I did it wrong or using the wrong branch (master).
However, implementing @Skolmeister 's solution worked.
mihaiconstantin commentedon May 18, 2026
The
3.0.0-rc1version does seem to fix the issue, however I encountered a bug when runningView(...)in a debugging context.After more testing, @Skolmeister's suggestion seems to work for extension version
2.8.8withRversion4.6.0.T0bC commentedon May 27, 2026
Had the same issue after updating R from 4.5.2 to 4.6.0.
.vsc.attach()could not be found anymore.The root cause is that R 4.6.0 no longer calls
.First.sys()during startup. The extension's init.R relies on overwriting.First.systo initialize the session watcher, so the attach function never gets defined.Fix that worked for me (in init.R of the extension, for me located at
~/.windsurf/extensions/reditorsupport.r-2.8.8-universal/R/session/init.R):.First.systo.First:and inside
init_last:- old.First.sys()After restarting the R terminal everything attaches correctly again. This should probably be patched in the extension since R 4.6.0 deprecated
.First.sysentirely.nsimsek-aba commentedon Jun 2, 2026
The .First.sys() fix is working for me too but I was unable to implement it in .Rprofile. Waiting on a more permanent solution. Thanks all!
T0bC commentedon Jun 3, 2026
What do you mean by "unable to implement it in .Rprofile". Whats happening and what would you expect?
nsimsek-aba commentedon Jun 3, 2026
I tried to put the ".First.sys()" into .Rprofile so that it would run when an active R terminal was opened in VS code without me manually typing and setting it, but it didn't register. I am still writing it into the terminal for it to attach.
16 remaining items
eitsupi commentedon Sep 20, 2026
This has already been resolved in main, so I'll close it (I'll pin it instead).
The 3.0.0 release is being tracked in #1727.
eitsupi commentedon Sep 27, 2026
Version 3.0.0 has been released.
leanhdung1994 commentedon Sep 28, 2026
eitsupi commentedon Sep 28, 2026
leanhdung1994 commentedon Sep 28, 2026
eitsupi commentedon Sep 28, 2026
leanhdung1994 commentedon Sep 28, 2026
eitsupi commentedon Sep 28, 2026