Is this ttyrec with json output?
Because checking some of the Debian patches accrued against ttyrec, and the source to rewindtty, it seems that rewindtty does not have some of the common programming mistakes that the author of ttyrec made a quarter of a century ago.
* https://sources.debian.org/src/ttyrec/1.1.7.1-1/debian/patch...
* https://github.com/debba/rewindtty/blob/develop/src/recorder...
* https://github.com/mjording/ttyrec/blob/master/ttyrec.c#L328
rewindtty will error out if the SHELL environment variable's value does not have a directory prefix, but at least it won't outright crash. (-: