I found a bug in erlang-mode, perhaps an elisp hacker can shed some light?
Here's a function to reproduce it:
(defun erlang-mode-bug ()
"Causes a bug in erlang-mode.
If you open a list with '[' and then end the line with only whitespace
or comments, then there is an error when you try to move sexp-at-a-time
within the list.
This has side-effects, for example if you try to indent on the second line
Then you'll trigger this error."
;; and leave the point at the start of the second line
(save-excursion (insert "]"))
;; moving forwards- or backwards- by a sexp triggers a bogus error