Interpolation can and does insert % placeholders into the printf
template text - although not valid ones as they're intended for
python.
So be more careful! Put all inserted text into the parameters to
printf, or use echo.
Also, keep some of the alterations used whilst diagnosing this.