# Save Error

1. What browsers show this problem?
Chrome (not tested on others)

2. Describes the steps to reproduce this issue.
Not sure.

3. What does Snap! currently do?
When I try to save with keyboard shortcut, the browsers download locator opens with the save name as 'Snap! Build Your Own Blocks 5.1.0.html' (obviously the <title> as a html file).

When I try to save it from the menu, it just says 'Saving project to the cloud' forever (same with 'Save As').
If I try to download it, it says 'Export failed: TypeError: Cannot read property 'toString' of null'.

I only lost a bit of work - about 5 mins, so it's fine.

Any suggestions?
Thanks!

EDIT:
It's happened twice on the same project now.
I would give you the HTML of the file it wants to download (which I mentioned earlier), but I can't figure out how to add HTML (or any non-image) files to this post.

This is happening to a student of mine. Don't know if the error can be reproduced because his project is just infinitely trying to save ...

When he tried to export it, it says the TypeError ToString to null msg.

Cheers,
Brendan

P.S. It is working now. The only thing he changed was that he had a replace block that replaced with a blank. I told him to look for any blanks in case of the null. He changed it to replace item in list with asterisk and it saved, but then changed it back to blank and it can still save after that. Might have been the issue or just might have been coincidence, as the block had tons of code.

I think that's the problem: Snap! can't save empty replace blocks.
Try saving a clean project with this in:

It should create an infinite save with file > save; show an export box with Ctrl+S; and show an error if you try to export it.
However saves fine if you add something to the replace block.

I know the snap team are totally overloaded with work, but I don't know much JS so I can't really create a pull request, and I think this is a fairly reasonably sized but easy-to-fix issue, @bh...

Weird. If you don't have the list variable in the replace block in works. But as soon as you have a replace block with a variable list, trying to replace with a blank it freezes up on the save.

Thanks for all your help narrowing down the problem. That'll help someone braver than I (@jens) dig into the dreaded serialization code.

I can't reproduce it. It's certainly not caused by an empty input slot in the REPLACE block.

Oh. That's annoying.

OK, that's weird because I tried it three times in a row, even reloading the page each time, and it didn't save on any of them, but now I try to do it it works fine.
The mystery deepens...

Adding something in the replace block didn't work initially. Then I thought maybe it was because I had run the code when the replace was empty. So I thought maybe running the code with something in the replace would fix the issue. So I ran the code with something in the replace. From there I was able to export the project. Problem fixed. Hope that helps!

It works for me I just tried exporting a project with an empty replace block.

sorry you're encountering this issue. Just wanting to let you know that this will be fixed in the upcoming minor release due sometime next week.