# Corrupted git on launcher rebuild app

**URL:** https://meta.discourse.org/t/corrupted-git-on-launcher-rebuild-app/374109
**Category:** Self-hosting
**Created:** [July 14, 2025, 9:09am UTC](https://meta.discourse.org/t/corrupted-git-on-launcher-rebuild-app/374109 "2025-07-14T09:09:13Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![anisus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anisus/32/512401_2.png) [@anisus](https://meta.discourse.org/u/anisus)
#### Post date: [July 14, 2025, 9:09am UTC](https://meta.discourse.org/t/corrupted-git-on-launcher-rebuild-app/374109/1 "2025-07-14T09:09:13Z")

</div>

After upgrading `docker_manager` through the UI (which seemed to go fine), the _Admin_ dashboard just rendered an empty page, even if the rest of the forum seemed to work.

To resolve this, I resorted to run:

```bash
./launcher rebuild app

```

However, during that process, it ran into errors:

```plaintext
I, [2025-07-14T08:54:06.062789 #1] INFO -- : > cd /var/www/discourse && sudo -H -E -u discourse bash -c '
  set -o errexit
  if [$(git rev-parse --is-shallow-repository) == "true"]; then
      git remote set-branches --add origin main
      git remote set-branches origin tests-passed
      git fetch --depth 1 origin tests-passed
  else
      git fetch --tags --prune-tags --prune --force origin
  fi
'
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index

```

… and the `error: packfile` just continues to be spammed until interrupted.

From the looks of it, the _git_ repository has become corrupted. But what git repository?  
I don’t even have a `/var/www/discourse` folder, so I assume this is inside a container volume?

I am a bit stumped. Thanks for helping!

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 14, 2025, 9:26am UTC](https://meta.discourse.org/t/corrupted-git-on-launcher-rebuild-app/374109/2 "2025-07-14T09:26:37Z")

</div>

> [@anisus](#):
>
> After upgrading `docker_manager` through the API (which seemed to go fine)

What do you mean by that?

Normally you’d update `docker_manager` via the _UI_.

---

<div class="post-metadata">

### Author: ![anisus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anisus/32/512401_2.png) [@anisus](https://meta.discourse.org/u/anisus)
#### Post date: [July 14, 2025, 9:31am UTC](https://meta.discourse.org/t/corrupted-git-on-launcher-rebuild-app/374109/3 "2025-07-14T09:31:09Z")

</div>

Aah! My mistake. I meant UI, not API. I’ll edit it right way.

---

<div class="post-metadata">

### Author: ![anisus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anisus/32/512401_2.png) [@anisus](https://meta.discourse.org/u/anisus)
#### Post date: [July 14, 2025, 11:13am UTC](https://meta.discourse.org/t/corrupted-git-on-launcher-rebuild-app/374109/4 "2025-07-14T11:13:18Z")

</div>

I tried to have resolved it by starting and entering the app container:

```plaintext
./launcher start app
./launcher enter app

```

Then I verified that the error occurred when calling the git command as the user `discourse`:

```plaintext
cd /var/www/discourse
sudo -H -E -u discourse bash -c 'git fetch --tags --prune-tags --prune --force origin'

```

Resulting in:

```log
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
error: packfile .git/objects/pack/pack-581fe47ace192793da04d01989a4d1a7f0e6103c.pack does not match index
etc..

```

I tried to resolve it by renaming discourse and clone a new one:

```plaintext
cd /var/www
mv discourse discourse-old
git clone https://github.com/discourse/discourse.git
chown -R discourse:discourse discourse

```

Once cloned, tried to run the `git fetch` again with no errors!

```plaintext
cd /var/www/discourse
sudo -H -E -u discourse bash -c 'git fetch --tags --prune-tags --prune --force origin'

```

But as I exited the container shell and tried to rebuild again with `./launcher rebuild app`, I got the same error.

Does the `./launcher rebuild app` use a different container than `./launcher enter app` enters?

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [July 14, 2025, 11:28am UTC](https://meta.discourse.org/t/corrupted-git-on-launcher-rebuild-app/374109/5 "2025-07-14T11:28:50Z")

</div>

yes, there are two levels of git, one outside (not including all the cloned plugins!)

your error does indeed appear to occur inside the container … most strange!

---

<div class="post-metadata">

### Author: ![anisus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/anisus/32/512401_2.png) [@anisus](https://meta.discourse.org/u/anisus)
#### Post date: [July 14, 2025, 1:11pm UTC](https://meta.discourse.org/t/corrupted-git-on-launcher-rebuild-app/374109/6 "2025-07-14T13:11:59Z")

</div>

Finally got it to work!  
I think it was a mixture between a corrupted _git_ and the result of a previous docker upgrade. I resolved it by pruning all docker containers and images:

```plaintext
cd /opt/discourse
./launcher stop app
docker container prune
docker image prune -a
./launcher rebuild app

```

This resulted/ended with:

```plaintext
Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade.
Once you start the new server, consider running:
    /usr/lib/postgresql/15/bin/vacuumdb --all --analyze-in-stages

Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh
-------------------------------------------------------------------------------------
UPGRADE OF POSTGRES COMPLETE

Old 13 database is stored at /shared/postgres_data_old

To complete the upgrade, rebuild again using:

./launcher rebuild app
-------------------------------------------------------------------------------------

```

By running the rebuild again, it started working fully:

```plaintext
./launcher rebuild app

```
