Description of the error
I don't know the details, but according to the scipy documentation https://docs.scipy.org/doc/scipy-1.17.0/reference/generated/scipy.signal.filtfilt.html, they suggest that sosfiltfilt should be preferred over filtfilt.
Any reason why we are using filtfilt over sosfiltfilt?