Tip for fixing funny 0 width space compile error

One might experience an interesting compile error…

unexpected token: "​" (column 1, code point U+200B)

…when compiling a phoenix project for iex.

The U+200B code, thank GOD it was there, can be looked up online, it means 0 width space. There are some platforms that allow one to copy this 0 width space.

After copying it, paste it into your ide’s “find” input field. I thought I only had one 0 width space, turns out I had eight. Deleted them all and the error was resolved.


I accidentally write that all the time on my mac… very annoying.

1 Like

option + space ? all the time, I hate it.

edit: well actually that does a space with width. I remember on windows there were a funny (some key) + backspace that inserted a zero space width. Happened all the time too.

Doesn’t go well with schedules.

My devs had this problem frequently when using Mac + vscode + vagrant. I moved on to another job and have always used Linux, though.

I’m on linux. I wonder how it happened.

There are some extensions for editors to highlight these 0 width spaces and other invisible or easy to mistake characters.

It pays off to have them installed to avoid this obnoxious problems


Yeah, option + space… usually happens after a pipe | :roll_eyes:

1 Like

It probably could be fixed in similar way to Rust. It has big list of “similar” Unicode characters and will print message with name of the incorrect character next to the character that user probably wanted.

This probably would be a nice addition and maybe @josevalim can express his feelings about similar behaviour, as plain U+200B will not always tell users what can be wrong. More expressive errors in that case could be helpful in some situations.


Yeah, I like the Rust approach. Giving a bit more context to common error cases can definitely be helpful. PRs are welcome!


I have Option-Space as a hotkey for an application, which I never thought would have the side effect of preventing me from typing these characters. :slight_smile: