Adding anchors to invalid aliases results in exceptions thrown instead of gracefully failing.
To reproduce, add this to a document:
[[this-just-fails|Some bad reference]]
[[this-fails#catastrophically|Some bad reference]]
[[#this-breaks-it-again|Some bad anchor]]
I'll have a PR ready in a few minutes with a solution!