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
{{ message }}
Repository navigation
Issue with utils::choose.dir() function in RStudio version 2023.03.0 Build 386 after updating R #13078
RStudio Edition : Desktop
RStudio Version : RStudio 2023.03.0+386 "Cherry Blossom" Release
OS Version : Windows 10 22H2 19045.2846
R Version : 4.3.0
Dear RStudio Team,
I hope this message finds you well. I am writing to report an issue I have encountered while using RStudio version 2023.03.0 Build 386.
After updating the R engine to version 4.3.0, I have noticed that when I execute the function utils::choose.dir(), it returns NA without opening the folder selection window as expected. However, this issue does not occur when running the function in the R console outside of RStudio.
As a temporary workaround, I have found that if I first invoke the base::file.choose() function and then run choose.dir() within the same RStudio session, the folder selection window does appear.
I wanted to bring this matter to your attention, as it seems to be specific to RStudio and not to the R console itself. I hope that you can look into this issue and provide a resolution or guidance on how to address it.
Thank you for your continued support and for developing an excellent product. I look forward to hearing from you soon.
Best regards,
Percy Rodríguez
Reacted by paradoxical-rhapsody, JoaoPSVieira, Torben Wittwer, ismirsehregal, VladimirVinarsky and namarkus
I got here because I'm experiencing the same problem. Apologize for ignorance, but I don't know what Rterm.exe is (is that what RStudio is running as a console?).
FWIW, here's what I'm running:
version
_
platform x86_64-w64-mingw32
arch x86_64
os mingw32
crt ucrt
system x86_64, mingw32
status
major 4
minor 3.1
year 2023
month 06
day 16
svn rev 84548
language R
version.string R version 4.3.1 (2023-06-16 ucrt)
nickname Beagle Scouts
RStudio 2023.06.1+524 "Mountain Hydrangea" Release (547dcf8, 2023-07-07) for windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2023.06.1+524 Chrome/110.0.5481.208 Electron/23.3.0 Safari/537.36
@sjackson1997 Yes, RTerm.exe is how RStudio runs R. Thank you for your report. I don't think there's a workaround for this other than downgrading R.
From my quick investigation, I think RGui works since it is meant to show a graphical interface. RTerm might not support this since it is supposed to be a terminal environment. Maybe the R update changed this behaviour because it aligns with the purpose for RTerm. It's unknown at this time if there's a solution for this.
Hi All - I've recently run into this issue as upgrading R broke some a Shiny app which depended on the choose.dir() function. Any suggestion on working around this? From what I am reading it sounds like this is a problem with R and thus R needs to be downgraded to fix the problem.
Just to widen the range of the issue to other people who might not be as familiarized with the language: when using R in VSCode the same issue occurs, so as the workaround of calling choose.file() before choose.dir() to prompt selection dialog to open. It reinforces that the issue is with RTerm, as the R Extension for VS Code runs on it as well and, also in my case, RGui.exe shows no issue.
I was struggling to find reports of my problem because I thought it was a R Extension for VS Code specific, but it doesn't seem to be the case.
Any fixes or workarounds on this issue? It`s been 3 years I'm getting this error. The issue was first reported at R 4.3. We are at R 4.6 and still no fix.
Any fixes or workarounds on this issue? It`s been 3 years I'm getting this error. The issue was first reported at R 4.3. We are at R 4.6 and still no fix.
Hi,
as a workaround, using tcltk::tk_choose.dir() works for me.
Activity
kevinushey commentedon May 2, 2023
Note for anyone investigating;
choose.files()andchoose.dir()are both functions only available on Windows builds of R.timtmok commentedon May 30, 2023
This looks like a problem with Rterm.exe. I don't get the selection dialog.
If I use Rgui.exe then I do get the selection dialog.
Edit: It also works, as reported, after using
file.choose().sjackson1997 commentedon Aug 26, 2023
I got here because I'm experiencing the same problem. Apologize for ignorance, but I don't know what Rterm.exe is (is that what RStudio is running as a console?).
FWIW, here's what I'm running:
RStudio 2023.06.1+524 "Mountain Hydrangea" Release (547dcf8, 2023-07-07) for windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) RStudio/2023.06.1+524 Chrome/110.0.5481.208 Electron/23.3.0 Safari/537.36
timtmok commentedon Aug 28, 2023
@sjackson1997 Yes, RTerm.exe is how RStudio runs R. Thank you for your report. I don't think there's a workaround for this other than downgrading R.
From my quick investigation, I think RGui works since it is meant to show a graphical interface. RTerm might not support this since it is supposed to be a terminal environment. Maybe the R update changed this behaviour because it aligns with the purpose for RTerm. It's unknown at this time if there's a solution for this.
gagecarto commentedon Oct 26, 2023
Hi All - I've recently run into this issue as upgrading R broke some a Shiny app which depended on the choose.dir() function. Any suggestion on working around this? From what I am reading it sounds like this is a problem with R and thus R needs to be downgraded to fix the problem.
Many thanks
ismirsehregal commentedon Dec 18, 2023
I also just came across this problem - same behaviour when using Rscript.exe, but I can't seem to find any "official" news about this.
@gagecarto regarding shiny you might want to check:
https://github.com/thomasp85/shinyFiles
jeroen commentedon Jan 8, 2025
This might hint at a naming conflict with system dll's, see: r-lib/textshaping#36 (comment)
To work around the problem you can
dyn.load()the required Windows system dlls manually before anything else.gabrjork commentedon May 29, 2025
Just to widen the range of the issue to other people who might not be as familiarized with the language: when using R in VSCode the same issue occurs, so as the workaround of calling choose.file() before choose.dir() to prompt selection dialog to open. It reinforces that the issue is with RTerm, as the R Extension for VS Code runs on it as well and, also in my case, RGui.exe shows no issue.
I was struggling to find reports of my problem because I thought it was a R Extension for VS Code specific, but it doesn't seem to be the case.
saulo1305 commentedon May 25, 2026
Any fixes or workarounds on this issue? It`s been 3 years I'm getting this error. The issue was first reported at R 4.3. We are at R 4.6 and still no fix.
torden81 commentedon May 26, 2026
Hi,
as a workaround, using
tcltk::tk_choose.dir()works for me.Apart from that, you might have more success getting this issue addressed by reporting it to the R project directly, as it seems to be unrelated to RStudio.
For issues in base packages like {utils},
bug.report(package = "utils")points to: https://bugs.r-project.org/initialize COM on the main thread at rsession startup on Windows (#18237
kevinushey commentedon Jul 20, 2026
Should (finally) be resolved, with a fix to be included with the upcoming release in August.