Can be reproduce here: https://restbase-beta.wmflabs.org/en.wikipedia.beta.wmflabs.org/v1/?doc
POST /transform/wikitext/to/html
{wikitext: '{{{foo}}}', bodyOnly: true}
-> <p about="#mwt1" typeof="mw:Param" id="mwAQ">{{{foo}}}</p>
POST /transform/html/to/wikitext
{html: '<p about="#mwt1" typeof="mw:Param" id="mwAQ">{{{foo}}}</p>'}
-> 500 (unknown error)
Note: these transformations work when going to parsoid directly but not when going through restbase.