Cannot open RMarkdown file

Hello I was working on a project in r markdown with Rstudio. Usually I leave some r markdown files open in the r studio. But I cannot open the main file and don' t know how to recover at least the plain text code.
The other files are available and I can open them but not the most important. This is the error:
And in the console when I try the open it shows:

Error: embedded nul in string: '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\ ecc.ecc.

Is there a method to open this file? or at least recover its rmarkdown script?
This file weight 36k so it's should not have lost its content inside, infact the other rmd file with 7.2k opens correctly. I really don't understand what happened to that file...

This is a weird issue.

Can it be open in another text editor ? Can you share the Rmd document ?

Seems like a corruption somewhere while saving the file in the IDE. Is this still happening with other files ?

Hi, I have a similar problem. I saved the file yesterday evening then got this error when I tried reopening it the next morning. Any help will be appreciated (I tried attaching the MD file but the site is not allowing me to).

Are you using the last version of the RStudio IDE ?

I don't see how it could be related to rmarkdown package. Probably some weird thing from the IDE you are using. I'll move this to the RStudio IDE category for visibility

good evening.

Was a solution found for this issue?

Hi, did you eventually find a solution?

No I cannot open it in anyway.
Yes probably a corruption occurred.
The other files are good for now.

No unfortunately. Better to save from time to time the file or use some kind of versioning. Better safe than sorry


Same issue here. I recently migrated from Intel-Mac and Windows duo synced through Onedrive to a new apple M1 machine. Almost 90% of files are giving to me this error when loaded RStudio fresh installation:

Error: embedded nul in string: '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\

RStudio version: 2022.07.2 Buil 576


I have the same problem. Wishing I had version control because now this very long file is corrupted. Has anyone found a solution to this? Is it possible that previous versions are stored somewhere else? Could this be a virus?

Unfortunatelly I don't think there are previous versions stored somewhere. I need to learn github for R. Sometimes I heard also that antivirus can cause some problem...idk. I use McAfee

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.