Bug or more likely I'm doing something wrong?

If you really wanted to be fancy you could replace the /cast Heart Essence line with ~~HE~~

Create a variable with the name HE and has the value
function() local itemLink= GetInventoryItemLink("player", 2) if GetItemInfo(itemLink) == "Heart of Azeroth" return '/cast Heart Essence' end end

What this would do is If you have a Neck Equipped, when GSE compiles your macro it would replace the ~~HE~~ in your macro with /cast Heart Essence otherwise it would delete the ~~HE~~ and skip that line.