I'm pretty sure this has something to do with corruption as my drive was corrupted just a few days ago but I managed to fix it.
The error occurs when I try to download or update anything, for example if i try to run sudo apt upgrade
I get this.
dpkg: warning: files list file for package 'linux-generic' missing; assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting: files list file for package 'libxapian30:amd64' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
By the way im on pop os 22.04, jammy.