New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Source pane displays non-empty R script as empty #1623
Comments
Does this always occur when you restart the IDE with that file open, or was this a one-time issue you noticed? |
It happened to me as well today. Closing the project and restarting RStudio did not solve anything, but reopening the script did. @kevinushey For me it was a one-time issue. Windows 7 x64 |
It happened two or three times. Maximum of 3 scripts were empty at once. |
Same here. @kevinushey It happens from time to time, up to now in Shiny projects only. @jmcphers A repro is hard to build - it happens randomly (up to now I dont see any pattern) Session info ---------------------------------------------------------
version R version 3.4.2 (2017-09-28)
system x86_64, mingw32
ui RStudio (1.1.383)
language (EN)
collate German_Switzerland.1252
tz Europe/Berlin
date 2017-10-21 |
Can you share the output of a diagnostics report? If the document is long, you might want to upload it as e.g. a GitHub gist and share a link to that. |
The issue did not happen again - so I can't upload any diagnostics report. |
It happened to me again today. Here is a diagnostics report: diagnostics-report.txt Note that I removed old log lines and that I anonymized a few elements. I kept the latest log lines but they were generated before I opened that project. Also note that this morning I updated R from 3.4.2 to 3.4.3 (from Rgui, using |
@kevinushey I pulled some state from someone experiencing this issue (ping me offline if you'd like the full data). What's happening in at least some cases is that the source database migration from 1.0 to 1.1 is failing for some files; the file gets moved, but its contents aren't transferred. In example I have, there isn't an obvious culprit -- some files are migrated successfully, but others (most) are not. |
I was able to reproduce this issue in the following way.
I think this is because we don't fully migrate to the new format on the first transfer of files. On the first open of RStudio v1.1, the sources folder looks like this:
After a close + re-opening of the IDE, it looks like this:
Because those |
Backported fix to 1.1 in 160fe9d. |
We have a preview release for an upcoming 1.1 patch at |
Hi I still have this issue in my system- windows 10 and RStudio version Version 1.1.456 – © 2009-2018 RStudio, Inc.. I am seeing all data when i open the file with notepad but while opening in R, its blank file. have we nailed down the issue and is the solution available? |
Hi, the issue still persists. I did numerous re-installation but no way out. I am doing it with Anaconda3-2019.10-Windows and RStudio 1.1.456. The notepad shows the script intact but Studio editor is blank and knit produces output document correctly. It's funny and irritating... Please share if there is a solution. |
I am facing this issue on version 1.2.5033 of Rstudio server on hosted on my Ubuntu 16.04 desktop. The symptoms (file tree) are very similar to what @kevinushey mentioned. I usually open the code in detached mode (detached from the panes by clicking "show in new window") to work on it on another vertical monitor. This probably the reason that every time I open the Rstudio I get another window open having two tabs, both are the same exact file and of course empty and not saved! every time I press the x on the top right corner of the tabs and select "Don't save", the next time I open the Rstudio it re-appears again! |
I came across this issue while I was facing the same problem, but after various hit and trials and understanding what can be the causes of this problem, |
You can try what I just tried and it solved the issue for me. |
@Stalwart-GS I personally hate anaconda and what it does to my system. it's been years that I'm avoiding it, and I've always (since day 1) have installed Rstudio from their official .deb file, and yet I have this issue, hence your hypothesis, unfortunately, is wrong (or at least not completely correct). |
@mmahmoudian There could be an issue with your workspace. I fixed my friend's Rstudio with this issue by pressing control-shift-F10 to clear the workspace, closing out of Rstudio, and opening it back up. |
@robbwh just checked it, nope, it does not fix the issue. This is clearly a bug in the way Rstudio is storing the open files |
@mmahmoudian What version of R are you using and what browser are you using to connect to RStudio Server? And does the issue only occur when you have a file in a separate window? |
I had the issue with the Anaconda and RStudio 1.1.4.56. I opened the file in a new window or new project and now is working fine. No re-installation and no complicated fixes. It might be something on the configuration and the rendering. Forgot to mention that I'm on Windows 10 in case it has anything to do. Thank you! |
This happened to me as well. As mentioned earlier, my issue had to do with the Anaconda version. I fixed it by installing Rstudio and then re-downloading the latest version from their official website. |
Had this issue after updating to R 4.2.0/RStudio 2022.02.2 Build 485 and @Azures729 solution worked as well. |
Same as @samzipper : I just uninstalled RStudio and installed from RStudio.com and I still encounter this issue in build 485. Reopen in UTF-8 does make things visible, but all .r files I have tried open apparently blank when opened with my system default ISO-8859-1. Release: RStudio 2022.02.2+485 "Prairie Trillium" Release (8acbd38, 2022-04-19) |
@samzipper and @Futats what operating systems are you using? Triage: Possible regression. |
@ronblum Thanks for investigating - to provide some more detail, re-opening with encoding works, but I have to re-do it with each source file. Setting UTF-8 as default it doesn't seem to carry over from file to file, either within the same RStudio session or across multiple sessions. RStudio: "Prairie Trillium" Release (8acbd38, 2022-04-19) for Windows Windows: |
For me, setting UTF-8 as the default worked for all .r files I tried and persisted across RStudio reboots, but the issue comes back for every file if I return to my system default ISO-8859-1. RStudio: "Prairie Trillium" Release (8acbd38, 2022-04-19) for Windows Windows: |
God bless you! The solution worked for me too! |
FYI @kevinushey penny for your thoughts |
This appears pretty serious to me. It's likely related to the changes in R 4.2.0 on Windows to use UTF-8 as the default locale. I can also reproduce whenever I try to re-save a "large" document (larger than 1kb on disk) with a non-UTF-8 encoding (via File -> Save with Encoding). When I do this, the file saved on disk is now size 0. As far as I can see, there is no error logged or anything else; we're just silently losing the file contents. My guess is that the code here is silently failing for some reason: rstudio/src/cpp/session/modules/SessionSource.cpp Lines 446 to 468 in 925ba91
If that's the case, stepping through this code may be fruitful: Lines 145 to 200 in 925ba91
|
I've filed #11206 to track this particular iteration of the issue. Note that the issue should only effect RStudio on Windows with R 4.2.0. Please direct any other follow-up there. |
After opening an existing project in RStudio, one of my scripts "how_to_use-Ex.R" is displayed in source pane as though it was empty. You can see it isn't (size of 1.8 KB).

Fortunately, the script has not been erased. Reopening the script in RStudio solves empty display problem.
OS X 10.11.6 (15G31)
RStudio 1.1.383
The text was updated successfully, but these errors were encountered: