Files missing, then Internal Server Error

Nextcloud version: 27.1.0
Operating system and version: Raspberry Pi OS (ubuntu bullseye 6.1.21) (headless)
Apache or nginx version (eg, Apache 2.4.25): 2.4.57
PHP version (eg, 7.4): 8.1.23


Nextcloud AIO docker on a 64-bit 8gb Pi 4, with external 1TB NTFS SSD. Nextcloud connected via. cloudflare tunnel, and AIO interface accessed over Tailscale (albeit irrelevent - issue persisted before tailscale was installed). Collabora and Imaginary installed.
I don’t remember the command I ran to create the main nextcloud aio docker container, and I don’t have a compose file so I’m hesitant to delete + recreate the container.

The issue you are facing:

tl;dr: files don’t appear in files app, but local files are still there. Possibly due to switching data drives. Seemingly unrelated new Internal Server Error persists through docker container restarts, preventing me from accessing the server.

A few months ago I started running Nextcloud fresh using the AIO docker. After a bit of fumbling around to set it up, I got it set up working fine, and successfully shared files and set up user accounts for about a month (mid Jul to early Aug), with daily backups and weekly updates.
It was going well (although had a few issues with the drive being disconnected causing Nextcloud to continually restart its containers, but that seemed to not be too much of a problem). I regularly synced Joplin with webdav to NC, and often added files over SFTP then re-scanned the folders (sudo docker exec -u www-data nextcloud-aio-nextcloud php occ files:scan --all).
For some reason, I logged in one day to find that no files showed up in the NC Files app. Some still showed in Recents, but if I tried to create files in the Files app, they would appear bugged (the name wouldn’t show up, just a line). The files on the disk were all still there, and re-scanning the folders as previously mentioned didn’t help. A few days later they were all back again but this didn’t last long.
I don’t think I have any apps that would break anything - I installed a few apps but nothing large.
About early August I attached an HDD to the Pi, but didn’t realise that would draw too much power, thus causing both disks to unexpectedly unmount or have odd issues. To avoid using the HDD, I transferred the nextcloud data directory from the old NTFS SSD onto my windows computer’s NTFS SSD, then onto the new 1TB NTFS SSD, but came across an error along the lines of “your data directory is invalid, ensure there is a file called .ocdata”. I touched the .ocdata file, and the error disappeared (iirc) but the files were again not showing up.
I left it for about a month since it was just a personal project and I had other things to attend to, but it still has the same problem now.
Today I rebooted the server and logged back in (all the logins and settings are still the same, and it still seems to know how much storage each user has taken up despite not showing the files). I looked through the Admin>Logging logs and there were quite a few errors from PHP and Nextcloud, that started appearing intermittently when I logged in (seemingly not caused by any commands or page loads I had run). It was working fine, then I clicked on the ‘Help’ button in the user avatar menu which loaded a page saying Internal Server Error (etc.) in plain text, which was then the case for every page on the Nextcloud site. I restarted the containers from the AIO interface but the issue persists, meaning I can’t easily access the logs for it. I can access nextcloud-aio-nextcloud:/var/www/html/data/nextcloud.log (8.5mb) but don’t want to share it here since it contains users’ file names.
The log files for the docker containers are also blank when accessed through the AIO interface, however I can get them through docker:

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

Thanks for any help, sorry that’s a lot of text! I could be missing something really obvious (I hope so). I’ll check back in the morning - sorry if I don’t respond before then.
If it’s not an easy fix, I might move away from nextcloud to something a little lower maintainance, since I’m evidently not good at sorting these issues! :)

(edit: replaced pastebin links)

Have there been any changes to open_basedir or your cache setup? I recently had an issue with APCu and Redis where the “Internal Server Error …” page would display and no errors were logged anywhere else when I attempted to enable Redis. The problem turned out to be the Archlinux package included open_basedir in nextcloud.conf and even though I had intentionally not enabled it in any of the php.ini files (or FPM ini files), the package file did in the conf file. Figuring out where the issue was reminded me of a trip to the dentist for a root canal. But after finding the issue, simply adding the redis runtime to open_basedir and everything came to life.

I don’t know if this is similar to what you are dealing with, but the “Internal Server Error …” page and nothing (or nothing concrete) in any of the logs was very similar to what I saw. Worth double checking all the various configs your distro uses.

I haven’t intentionally changed any of the setup, but I’ll have a look through anyway; thanks for giving me a solid place to start :)