I think you need errcontext(), not errdetail(). The most important difference is that you can have multiple CONTEXT lines but only one DETAIL; I think if you attach a second errdetail(), the first one is overwritten.
Indeed, the first errdetail() will be overwritten. Here's another try.