# My code is gone, help!

**URL:** <https://forum.makecode.com/t/my-code-is-gone-help/9331>\
**Category:** Arcade\
**Created:** [July 21, 2021, 3:23pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331 "2021-07-21T15:23:19Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 21, 2021, 3:23pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/1 "2021-07-21T15:23:19Z")

</div>

So I was working on a project and when I was finally done with my coding session today, I went to push to GitHub like I usually do, when I encountered an unknown error. After that everything started going downhill, I couldn’t push or pull from my repo, and I couldn’t convert my code to blocks anymore. This is a serious issue and I’m worried I might lose all of my code. Anyone, please look into this, I will be grateful for any solution, tips, help or assistance.  
[And here’s the reposotory](https://github.com/S0m3randomguy/Windows-7-Makecode-Edition)

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [July 21, 2021, 4:48pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/2 "2021-07-21T16:48:32Z")

</div>

I would suggest saving the project as an image until you can fix it so if you lose it you can just reopen the image in Arcade

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 21, 2021, 5:17pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/3 "2021-07-21T17:17:34Z")

</div>

But how? The only option it gives me is to save to GitHub.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/d/d063d1a9ebca118e65ff9bd071d1cbc568fbf794.png)

---

<div class="post-metadata">

**Author:** ![UnsignedArduino](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/unsignedarduino/32/592_2.png) [@UnsignedArduino](https://forum.makecode.com/u/UnsignedArduino)\
**Post date:** [July 21, 2021, 5:40pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/4 "2021-07-21T17:40:12Z")

</div>

Then press the download button and select any device. The code is also in the `.uf2` file you get and can drag it into the editor just like an image.

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 21, 2021, 6:15pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/5 "2021-07-21T18:15:58Z")

</div>

First, commit your local changes! Then try this

You hit a bug in makecode. Do you remember what you were doing right before the bug happened?

In any case, no worries! You’re using GitHub which means all of your changes from your previous commits are saved. Open the GitHub button and click “History”. Then click one of the dates and click “restore”. This will take your project back in time to that date and restore whatever you had then

Also, this is a non-destructive thing so you can always go back to what you currently have if it doesn’t work out.

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 21, 2021, 6:17pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/6 "2021-07-21T18:17:33Z")

</div>

Before you go through the steps I mentioned, make sure you commit any local changes you have. THis will make it easier for me to debug it if things go wrong

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 21, 2021, 6:21pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/7 "2021-07-21T18:21:06Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/9/953de873e4cc1d9ac4d3eb431609358941c2a621.png)  
How do I restore from here?

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 21, 2021, 6:21pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/8 "2021-07-21T18:21:21Z")

</div>

> [@richard](#):
>
> First, commit your local changes

Yeah, well that’s the problem, like I said:

> [@Sarge](#):
>
> I couldn’t push or pull from my repo

I can’t do anything. You could say I’m stuck in some sort of limbo.

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 21, 2021, 6:21pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/9 "2021-07-21T18:21:54Z")

</div>

Ah, I see. Well try and copy the JavaScript and put it in a file on your computer or paste it here.

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 21, 2021, 6:26pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/10 "2021-07-21T18:26:45Z")

</div>

As a matter of fact, I already did. It seems for some reason tho that it still won’t convert to blocks. Extention error? Idk but here’s the code-  
oh wait the limit is 30000 words and my code has 90000. snap.

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 21, 2021, 6:27pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/11 "2021-07-21T18:27:07Z")

</div>

save it as a .txt file and attach it to your post

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 21, 2021, 6:36pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/12 "2021-07-21T18:36:21Z")

</div>

Alright, here is your code:

> **[block-project](https://arcade.makecode.com/68290-01847-81628-58188)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 21, 2021, 6:36pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/13 "2021-07-21T18:36:35Z")

</div>

I did but MakeCode forums don’t allow txt files

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 21, 2021, 6:40pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/14 "2021-07-21T18:40:20Z")

</div>

Thank you so much! Some sprites are slightly broken, but that can do with some manual tweaking. Anyways, how were you able to restore this?

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 21, 2021, 6:44pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/15 "2021-07-21T18:44:21Z")

</div>

I took the code and put it into a new project, added the missing extensions, and switched to blocks.

The GitHub project won’t switch to blocks because it has a broken pxt.json file. If you look at the files list, there is an entry that says “null”. I’ve seen this bug a few times but I haven’t been able to figure out what causes it. If you go into the pxt.json and delete this text exactly (including the comma):

![Screen Shot 2021-07-21 at 10.20.21 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/4f018dba5764c3b35b1ad3909ec5920b415e9e87.png)

Then it _should_ be able to go back to blocks

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 21, 2021, 6:53pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/16 "2021-07-21T18:53:33Z")

</div>

I can’t tell you how grateful i am for this, you saved my entire project, not only that it wouldn’t convert but it also wouldn’t run the simulator.

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [July 21, 2021, 6:54pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/17 "2021-07-21T18:54:05Z")

</div>

No problem! Sorry this happened in the first place. Hopefully I can figure out what’s causing this bug soon.

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [July 21, 2021, 7:53pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/18 "2021-07-21T19:53:52Z")

</div>

I would really like to be of use figuring that out by giving some feedback, but I really don’t know what happened. I was just finishing my coding session, I implemented the things I wanted to put in and when I went to save that happened. I think though it might be some kind of request error as it gave me the “check your internet connection” error message. Maybe it couldn’t connect and it mistakenly inserted the null value at that location:

> [@richard](#):
>
> ![Screen Shot 2021-07-21 at 10.20.21 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/4/4f018dba5764c3b35b1ad3909ec5920b415e9e87.png)

Anyways, thanks again!

---

<div class="post-metadata">

**Author:** ![E-EnerG-Gamecentral](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/e-energ-gamecentral/32/5353_2.png) [@E-EnerG-Gamecentral](https://forum.makecode.com/u/E-EnerG-Gamecentral)\
**Post date:** [August 7, 2021, 11:32pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/19 "2021-08-07T23:32:20Z")

</div>

A bit of advice. I have 3 ways of saving my projects (this always works for me)

1. Using the Cloud 😃  
With the beta editor, I can save my projects to the cloud, so If they get deleted (bc of clearing cookies) I can always get them back 🙂
2. Saving  
Saving always helps. I save them as an image, so if they get deleted, or if they break, I can insert the image into Makecode 🙂
3. Links  
I use a google doc (well sometimes) and I paste it inside of it. If they get deleted, I can click the link and edit that code I had.

These work for me (especially with Cboy Azure) so hopefully these can work for you @Sarge!

---

<div class="post-metadata">

**Author:** ![kwx](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kwx/32/1545_2.png) [@kwx](https://forum.makecode.com/u/kwx)\
**Post date:** [August 9, 2021, 3:39pm UTC](https://forum.makecode.com/t/my-code-is-gone-help/9331/20 "2021-08-09T15:39:15Z")

</div>

These are all good options, there are two more methods I’m aware of:

- Create a download file for a hardware device. The generated .uf2 file contains a copy of the source code and is loadable via “import” or drag&drop in the editor.

- Use the share dialog to get an [arcade.makecode.com](http://arcade.makecode.com) link, and save that link in a document. This link will remain usable even if you don’t end up sharing it in the forum.

As a variant 9f the cut&paste method, you can also store the code in a plain text file and use the git tool to keep local history.

[Next page](https://forum.makecode.com/t/my-code-is-gone-help/9331.md?page=2)
