HandlerStackContext.removeAllPreceeding only takes into account the sequence number of the handler being visited. For example, if this is the third handler (sequence number 2), then two handlers are removed. However, if before the call to removeAllPreceeding there were other calculations, then the number to remove is different. For example, if removeFirst() was called before, then only one handler remains to be removed.