Microsoft MakeCode

My code is gone, help!

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

1 Like

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

1 Like

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

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.

1 Like

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.

1 Like

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

1 Like


How do I restore from here?

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

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

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

1 Like

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.

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

1 Like

Alright, here is your code:

2 Likes

I did but MakeCode forums don’t allow txt files

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?

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

Then it should be able to go back to blocks

1 Like

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.

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

1 Like

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:

Anyways, thanks again!