# Unable to rebuild discourse

**URL:** https://meta.discourse.org/t/unable-to-rebuild-discourse/344214
**Category:** Support
**Created:** [December 24, 2024, 2:33pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214 "2024-12-24T14:33:01Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![amsaal](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@amsaal](https://meta.discourse.org/u/amsaal)
#### Post date: [December 24, 2024, 2:33pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/1 "2024-12-24T14:33:01Z")

</div>

when ever i try to ./launcher rebuild app it gives an error.

root@amsaal:~# cd /var/discourse/  
root@amsaal:/var/discourse# ./launcher rebuild app  
x86\_64 arch detected.  
fatal: No such ref: HEAD  
fatal: No such ref: HEAD  
Stopping old container

- /usr/bin/docker stop -t 600 app  
app  
2.0.20241203-0251: Pulling from discourse/base  
Digest: sha256:d5d4e6d361d56745e37f2609db58a6970cc9b3fcd26d0b2dcba23d0cb581f067  
Status: Image is up to date for discourse/base:2.0.20241203-0251  
[docker.io/discourse/base:2.0.20241203-0251](http://docker.io/discourse/base:2.0.20241203-0251)  
/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups.rb  
/usr/local/bin/pups --stdin  
docker: invalid reference format: repository name (library/#\<NoMethodError) must be lowercase.  
See ‘docker run --help’.  
cat: cids/app\_bootstrap.cid: No such file or directory  
bootstrap failed with exit code 125  
\*\* FAILED TO BOOTSTRAP \*\* please scroll up and look for earlier error messages, there may be more than one.  
./discourse-doctor may help diagnose the problem.  
Container name cannot be empty  
root@amsaal:/var/discourse#

---

<div class="post-metadata">

### Author: ![Overgrow](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/overgrow/32/478189_2.png) [@Overgrow](https://meta.discourse.org/u/Overgrow)
#### Post date: [December 24, 2024, 2:58pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/2 "2024-12-24T14:58:38Z")

</div>

Did you check status of the launcher repo?

`git status`

---

<div class="post-metadata">

### Author: ![amsaal](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@amsaal](https://meta.discourse.org/u/amsaal)
#### Post date: [December 24, 2024, 3:11pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/3 "2024-12-24T15:11:47Z")

</div>

root@amsaal:/var/discourse# git status

No commits yet

Untracked files:  
(use “git add …” to include in what will be committed)  
.github/  
.gitignore  
LICENSE  
README.md  
discourse-doctor  
discourse-setup  
image/  
launcher  
rebuild.log  
samples/  
scripts/  
templates/  
tests/

nothing added to commit but untracked files present (use “git add” to track)  
root@amsaal:/var/discourse#

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [December 24, 2024, 3:30pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/4 "2024-12-24T15:30:13Z")

</div>

You should have seen something like this:

```plaintext
# git status
On branch main
Your branch is up to date with 'origin/main'.

nothing to commit, working tree clean

```

so I think somehow your /var/discourse directory is broken - is no longer connected to the repo. Did you somehow tidy up, lose, or rename the .git subfolder?

---

<div class="post-metadata">

### Author: ![amsaal](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@amsaal](https://meta.discourse.org/u/amsaal)
#### Post date: [December 24, 2024, 3:53pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/5 "2024-12-24T15:53:12Z")

</div>

i did not touch anything actually? how can i fix it?

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [December 24, 2024, 3:59pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/6 "2024-12-24T15:59:02Z")

</div>

Sorry, I don’t know. Do you have a .git subdirectory? What is in it?

In my case, the config file looks like this:

```plaintext
# cat .git/config 
[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	url = https://github.com/discourse/discourse_docker.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
	remote = origin
	merge = refs/heads/main

```

But this is for reference. I don’t think the fix is to edit a config file!

---

<div class="post-metadata">

### Author: ![amsaal](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@amsaal](https://meta.discourse.org/u/amsaal)
#### Post date: [December 24, 2024, 4:02pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/7 "2024-12-24T16:02:21Z")

</div>

i have same result

root@amsaal:/var/discourse# cat .git/config  
[core]  
repositoryformatversion = 0  
filemode = true  
bare = false  
logallrefupdates = true  
[remote “origin”]  
url = [GitHub - discourse/discourse\_docker: A Docker image for Discourse · GitHub](https://github.com/discourse/discourse_docker.git)  
fetch = +refs/heads/_:refs/remotes/origin/_  
[branch “main”]  
remote = origin  
merge = refs/heads/main

And git status

root@amsaal:/var/discourse# git status  
On branch main  
Your branch is based on ‘origin/main’, but the upstream is gone.  
(use “git branch --unset-upstream” to fixup)

Changes not staged for commit:  
(use “git add …” to update what will be committed)  
(use “git restore …” to discard changes in working directory)  
modified: .github/workflows/build.yml  
modified: LICENSE  
modified: README.md  
modified: templates/postgres.13.template.yml  
modified: templates/postgres.15.template.yml  
modified: templates/postgres.template.yml  
modified: templates/web.ssl.template.yml  
modified: templates/web.template.yml

Untracked files:  
(use “git add …” to include in what will be committed)  
rebuild.log

no changes added to commit (use “git add” and/or “git commit -a”)

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [December 24, 2024, 4:10pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/8 "2024-12-24T16:10:17Z")

</div>

Looks like you must have changed something - your latest `git status` gives you very different results from your previous report. This is mysterious!

---

<div class="post-metadata">

### Author: ![amsaal](https://avatars.discourse-cdn.com/v4/letter/a/258eb7/32.png) [@amsaal](https://meta.discourse.org/u/amsaal)
#### Post date: [December 24, 2024, 4:19pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/9 "2024-12-24T16:19:12Z")

</div>

so can reinstall discourse can solve it and can you advice how can i do it from SSH?

---

<div class="post-metadata">

### Author: ![Ed\_S](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ed_s/32/134015_2.png) [@Ed\_S](https://meta.discourse.org/u/Ed_S)
#### Post date: [December 24, 2024, 5:38pm UTC](https://meta.discourse.org/t/unable-to-rebuild-discourse/344214/10 "2024-12-24T17:38:06Z")

</div>

For a full reinstall, you need your full backup (including your app.yml file) and a fresh OS on your instance.

The instructions are here: [INSTALL-cloud](https://github.com/discourse/discourse/blob/main/docs/INSTALL-cloud.md)

It might be best to try the install on a new instance. You’ll need to add the new IP address to a temporary subdomain in your DNS. Or, if you are happy with the downtime, just update your DNS to the new IP address.

You do need to have some idea what you’re doing, otherwise you need help. Sorry, I can’t be that help.
