Oops, something went wrong trying to convert your code

One day, I was working on a platformer game based on “Jumpy Platformer”(in blocks). I switched in Javascript and it just happened that it said “Oops, something went wrong trying to convert your code.” I didn’t write or do anything. What should I do to fix this and prevent this from happening again.

This sounds like a bug. Would you mind sharing your project?

1 Like

Here’s my project :

This is a bug on our end; the issue is that in the call to scene.onOverlapTile() you passed an image literal (img`...` ) instead of something of the form mytiles.tile1.

To workaround this issue you should always declare images that you want to use in tile blocks inside of that namespace with a name of the form tile# where # is a positive integer. For example,

namespace myTiles {
    //% blockIdentity=images._tile
    export const tile0 = img`
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
        . . . . . . . . . . . . . . . .
    `
    //% blockIdentity=images._tile
    export const tile1 = img`
        e d f . . . . . . . . . . f e d
        e d f f f f f f f f f f f f e d
        e d d d d d d d d d d d d d e d
        e d e e e e e e e e e e e e e d
        e d f f f f f f f f f f f f e d
        e d f . . . . . . . . . . f e d
        e d f . . . . . . . . . . f e d
        e d f . . . . . . . . . . f e d
        e d f . . . . . . . . . . f e d
        e d f f f f f f f f f f f f e d
        e d d d d d d d d d d d d d e d
        e d e e e e e e e e e e e e e d
        e d f f f f f f f f f f f f e d
        e d f . . . . . . . . . . f e d
        e d f . . . . . . . . . . f e d
        e d f . . . . . . . . . . f e d
    `
}

I’ve opened an issue for this here: https://github.com/microsoft/pxt-arcade/issues/1738

And here is a version of your code that goes back to blocks:

Sorry that you ran into this!

Thanks for such a fast response!

@richard I’m not good at javascript and all of this is really confusing. It would help me and other collaborators on my project if this was fixed can you please simplify it more or just do it for one tile so I know how to do it? here is the link https://arcade.makecode.com/S65687-46887-31913-85979

Thanks

@platformermaster your issue is different than this one and has nothing to do with tiles. Actually, I have no idea how your project ended up in this state. For some reason your blocks.xml file was completely empty, which should never happen. Did you manually try to add a blocks file to the project by chance? If not, do you remember what you were doing when this problem started?

In any case, here’s your fixed project:

For documentation purposes, here’s how I fixed this problem (though I’ve never seen anyone else run into this scenario):

Summary

Note that theses instructions will almost definitely NOT fix your issue if you are getting the “Oops, something went wrong trying to convert your code” message. These are only the instructions for @platformermaster’s specific issue.

To fix this issue:

  1. I downloaded the project using the makecode cli
    makecode download https://arcade.makecode.com/S65687-46887-31913-85979
  2. I opened the project in a text editor and pasted the default project XML into main.blocks and saved the file
  3. I reshared the project with the cli
    makecode share
1 Like

Thanks, this helped a lot finally I’ll be able to work on my project with my collaborators. I don’t think I was messing around with the files until I had the problem and I think I was working on ore generation. Keep in mind other collaborators would work on the project too so maybe one of them did something. But I don’t really know.

This will be helpful as I’ve gotten an empty blocks.xml file before several times. No clue how they happen though, it’s usually during a GitHub commit where something gets screwed up…

hmmmm sounds like @platformermaster was also using github… that might be the culprit somehow.

@UnsignedArduino next time it happens can you note the commit hash when it happened and send me a link?

1 Like

@richard It happened again and I tried to follow your tutorial but I couldn’t understand what to download and what to put the link into. It would be great if you could do your magic again or if you could simplify the tutorial. Thanks (Here’s the link https://arcade.makecode.com/S11902-81129-28491-76909)

@platformermaster

Ok, I need to know how the simulator is blue RIGHT NOW! This could change EVERYTHING…

1 Like

[Tutorial] How to Change the Simulator Color - Arcade / Help - Microsoft MakeCode

Thats a tutorial from @Brohann where I found it from. Just know that you should make a backup before attempting.

1 Like

Thank you @richard can you teach me how to do it? (I know you said up above but I cant figure it out)

@platformermaster I am working on a fix for this, so hopefully it won’t be a problem much longer. that being said, I wrote up some instructions below. I do not recommend following them unless you have some experience with using Command Line tools

Note: this is something you’ll only be able to do from a windows, linux, or macos computer (not ios, android, or a chromebook).

  1. Install Node.js
  2. Install Visual Studio Code
  3. Open up a terminal
    a. On Windows, this will be called Command Prompt
    b. On MacOs and Linux, this will be called Terminal
  4. Run this command to install the MakeCode CLI:
    npm install -g makecode
  5. Run this command to create a new directory
    mkdir my-project
  6. Run this command to enter that directory:
    cd my-project
  7. Download your project using this command:
    makecode download https://arcade.makecode.com/S11902-81129-28491-76909
  8. Open the directory using Visual Studio Code:
    code .
  9. Open the main.blocks file in the left-hand pane and paste this code into it:
    <xml xmlns="http://www.w3.org/1999/xhtml">
      <variables></variables>
      <block type="pxt-on-start" x="0" y="0"></block>
    </xml>
    
  10. Save the file
  11. Reshare the project using this command:
    makecode share
  12. This should create a new share link that lets you decompile once again
1 Like

I might be able to do this. I have all the necessary tools. So if this happens again in the project I should be able to fix it.

thanks

This just happened to me - my tab closed while committing and my project is stuck on JS :frowning:

In case you’re still investigating more possible causes for this issue happening, I ran into it recently trying to manage a conflicting merge within MakeCode Arcade. It went roughly like this:

  1. Checked out repo and made conflicting edits on multiple local copies
  2. Attempt to git merge within MakeCode Arcade, UI got angry and spit out a PR
  3. Manually merged the PR via GitHub

You can see the blocks deleting PR here:

1 Like