Cannot access web interface after PiHole 6 update

I have resolved the issue - it was a corrupted web ui folder somehow!

root@pihole:/opt/pihole# ./update.sh
[✓] Supported OS detected
[✓] Update local cache of available packages
[✓] Building dependency package pihole-meta.deb
[✓] Installing Pi-hole dependency package

[i] Checking for updates...
[i] Pi-hole Core: up to date
error: inflate: data stream error (invalid stored block lengths)
fatal: packed object c4e173d8ac2495ca1c20ae3613009768438a1d12 (stored in .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack) is corrupt
fatal: fetch-pack: invalid index-pack output

Error: Unable to update local repository. Contact Pi-hole Support.
root@pihole:/opt/pihole#

I reverse engineered the script at pi-hole/advanced/Scripts/update.sh at 567bb724b18bf174f033d0b8b289cc44a5e9c8eb · pi-hole/pi-hole · GitHub

And saw the web-ui component was next in the list of errors. I did the following in the web ui directory:

root@pihole:/var/www/html/admin# git fetch
remote: Enumerating objects: 6385, done.
remote: Counting objects: 100% (5847/5847), done.
remote: Compressing objects: 100% (2574/2574), done.
error: inflate: data stream error (invalid stored block lengths)
fatal: packed object c4e173d8ac2495ca1c20ae3613009768438a1d12 (stored in .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack) is corrupt
fatal: fetch-pack: invalid index-pack output
root@pihole:/var/www/html/admin# git fetch --verbose
POST git-upload-pack (383 bytes)
POST git-upload-pack (gzip 2114 to 1067 bytes)
remote: Enumerating objects: 6385, done.
remote: Counting objects: 100% (5847/5847), done.
remote: Compressing objects: 100% (2574/2574), done.
error: inflate: data stream error (invalid stored block lengths)
fatal: packed object c4e173d8ac2495ca1c20ae3613009768438a1d12 (stored in .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack) is corrupt
fatal: fetch-pack: invalid index-pack output

root@pihole:/var/www/html/admin# git fsck --full
Checking object directories: 100% (256/256), done. error: .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack pack checksum mismatch error: index CRC mismatch for object 0aba561de4dccb0f40252e814d15cbc51afd417d from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 1048496 error: cannot unpack 0aba561de4dccb0f40252e814d15cbc51afd417d from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 1048496 error: index CRC mismatch for object cb0ea772fab28d4a497075ccac66682e1bb45686 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 1068561 error: unknown object type 0 at offset 1068561 in .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack error: cannot unpack cb0ea772fab28d4a497075ccac66682e1bb45686 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 1068561 error: index CRC mismatch for object cfdf5ccc46f70fd2c89b4a9b437e66b324dcab34 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 1084523 error: unknown object type 0 at offset 1084523 in .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack
error: cannot unpack cfdf5ccc46f70fd2c89b4a9b437e66b324dcab34 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 1084523
error: index CRC mismatch for object c4e173d8ac2495ca1c20ae3613009768438a1d12 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 2065345
error: inflate: data stream error (invalid stored block lengths) error: cannot unpack c4e173d8ac2495ca1c20ae3613009768438a1d12 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 2065345 error: index CRC mismatch for object d36c4523a4f79b63385e8339d7e3b3e136a11ae1 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 2114420 error: unknown object type 0 at offset 2114420 in .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack error: cannot unpack d36c4523a4f79b63385e8339d7e3b3e136a11ae1 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 2114420 error: index CRC mismatch for object e4677046ace857e1a43a9038fd22cac160b0fd83 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 2182094
error: unknown object type 0 at offset 2182094 in .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack
error: cannot unpack e4677046ace857e1a43a9038fd22cac160b0fd83 from .git/objects/pack/pack-10774ecb85ddb95f05f011ababdebed67b9a55dc.pack at offset 2182094
Checking objects: 100% (1354/1354), done.

The git fsck failing showed a corrupt repository so I researched how to repair a git repository and found the tool git-repair - installed and ran this with the --force flag and this repaired the repository.

Then ran git pull and the repository was now healthy. My web UI also works now!!

Probably a silly feature request but would it be worthwhile to add a git fsck to all the pihole stores in the debug script?