when pinentry-curses doesn't know the tty type, it fails with:
ERR 83886343 Line passed to IPC too long <Pinentry>
here's an example, using "env -i" to clean the environment.
$ THIS_TTY=$(tty)
$ echo getpin | env -i pinentry-curses --ttyname $THIS_TTY
OK Pleased to meet you
pinentry-curses: no LC_CTYPE known - assuming UTF-8
ERR 83886343 Line passed to IPC too long <Pinentry>
$
if i provide --ttytype=$TERM then things are fine.
This is an unintelligible error, and it probably doesn't even need to be an error.
If pinentry doesn't know the --ttytype, and $TERM is unset, to just guess at a
sensible terminal type like "vt100" or even "dumb" rather than failing with an
uninterpretable error message. even an error like GPG_ERR_ENOTTY would probably
be better (though "inappropriate ioctl for device" isn't particularly clear either).