# I accidentally deleted main.blocks

**URL:** <https://forum.makecode.com/t/i-accidentally-deleted-main-blocks/19271>\
**Category:** Help\
**Created:** [April 18, 2023, 8:06pm UTC](https://forum.makecode.com/t/i-accidentally-deleted-main-blocks/19271 "2023-04-18T20:06:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samsano](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/samsano/32/8307_2.png) [@Samsano](https://forum.makecode.com/u/Samsano)\
**Post date:** [April 18, 2023, 8:06pm UTC](https://forum.makecode.com/t/i-accidentally-deleted-main-blocks/19271/1 "2023-04-18T20:06:30Z")

</div>

When i try to fix it by adding another file named: main.blocks. but it turns it into: main.blocks.ts.

Is there a fix?

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [April 18, 2023, 8:48pm UTC](https://forum.makecode.com/t/i-accidentally-deleted-main-blocks/19271/2 "2023-04-18T20:48:47Z")

</div>

Can you share the project?

---

<div class="post-metadata">

**Author:** ![EpicKitty](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/epickitty/32/8358_2.png) [@EpicKitty](https://forum.makecode.com/u/EpicKitty)\
**Post date:** [April 19, 2023, 9:41pm UTC](https://forum.makecode.com/t/i-accidentally-deleted-main-blocks/19271/3 "2023-04-19T21:41:37Z")

</div>

1. Are you saving the project on GitHub and did you commit before you deleted main.blocks? You might be able to revert back to the previous version, I believe there’s a button on the GitHub commit screen on your Arcade project to revert back to the previous commit. (A commit is like a version that contains changes to files and code)
2. Switch to JavaScript or Python, then switch back to Blocks: If you’re lucky, Arcade might be able to convert the code back to blocks.
3. When you add/create a file, it’s empty. So you can’t recover it by adding a new file named after the file you deleted.

I hope you get your code back!

---

<div class="post-metadata">

**Author:** ![Samsano](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/samsano/32/8307_2.png) [@Samsano](https://forum.makecode.com/u/Samsano)\
**Post date:** [April 19, 2023, 9:45pm UTC](https://forum.makecode.com/t/i-accidentally-deleted-main-blocks/19271/4 "2023-04-19T21:45:23Z")

</div>

I took some pictures of it happening:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/9/9ba9eaa5f14019dd4fd90a44b8c218a9bb13484c.png)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/1/1e7941adc047437887a4197db3669ffb7fc640f4.png)

Here is a game just for show:

> **[Just for show](https://arcade.makecode.com/S67866-03943-85731-62942)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [April 19, 2023, 10:11pm UTC](https://forum.makecode.com/t/i-accidentally-deleted-main-blocks/19271/5 "2023-04-19T22:11:00Z")

</div>

Ah, I meant the game in which you want to have it fixed, not just a project without the file; I can mess around with it and manually fix it for this case, assuming you give me a project that has the ts / assets in it, but there’s no easy way right away in the editor. I filed [https://github.com/microsoft/pxt-arcade/issues/5855](https://github.com/microsoft/pxt-arcade/issues/5855) for a ‘general’ fix / easier path

---

<div class="post-metadata">

**Author:** ![Samsano](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/samsano/32/8307_2.png) [@Samsano](https://forum.makecode.com/u/Samsano)\
**Post date:** [April 20, 2023, 5:51pm UTC](https://forum.makecode.com/t/i-accidentally-deleted-main-blocks/19271/6 "2023-04-20T17:51:50Z")

</div>

Here is the game:

> **[TerrariaGame Lost main.blocks](https://arcade.makecode.com/S21484-15048-96142-05743)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

I tried to delete file i had misspelled and missclicked.

---

<div class="post-metadata">

**Author:** ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)\
**Post date:** [April 20, 2023, 6:24pm UTC](https://forum.makecode.com/t/i-accidentally-deleted-main-blocks/19271/7 "2023-04-20T18:24:48Z")

</div>

Here you go [https://makecode.com/\_PLoR7Kfi8hoK](https://makecode.com/_PLoR7Kfi8hoK) will generate the .blocks file back when you click into blocks

That said, this doesn’t look like a project that you would particularly want to go to blocks in, as it’s nicely formatted in text / swapping back and forth won’t look as pretty. One thing to note is that I did change this line:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/3/37acef80a7ab134d7aaa54b57fcf50507d20a4f4.png)  
as tiles.setTilemap is the old, deprecated version that doesn’t support variables in blocks (that is, it can only be set with a literal value like `tiles.setTilemap(`asdf`)` in blocks, so if you put a variable in it will get replaced with a new, empty tilemap)
