It seems that the :wrap header argument and the append option to the :results header argument are incompatible in source blocks. The reason is that `org-babel-result-end` does not find the end of the results when :wrap is used and this is due to `org-babel-result-end` only looking for blocks of type among `(drawer example-block export-block fixed-width item plain-list src-block table)` while the :wrap header argument produces blocks of type `special-block`. Appending `special-block` to the previous list seems to work. It has already been discussed in this thread http://lists.gnu.org/archive/html/emacs-orgmode/2018-10/threads.html#00393 which ends in a patch request that AFAIK has never been sent. Below is a patch. I also added some precisions in the docs concerning the raw option to the :results header argument (I am not a native speaker so do not hesitate to change my wording). I tried those changes on the master branch (commit a9d3eaa9f) and no new errors showed up during the ERT tests (4 tests failed but already failed without this fix). I also tried exporting to html and latex and it seemed to work fine here.