# Unable to rebuild app - Possible Data Explorer plugin issue?

**URL:** https://meta.discourse.org/t/unable-to-rebuild-app-possible-data-explorer-plugin-issue/163098
**Category:** Self-hosting
**Created:** [September 5, 2020, 8:57am UTC](https://meta.discourse.org/t/unable-to-rebuild-app-possible-data-explorer-plugin-issue/163098 "2020-09-05T08:57:31Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [September 5, 2020, 8:57am UTC](https://meta.discourse.org/t/unable-to-rebuild-app-possible-data-explorer-plugin-issue/163098/1 "2020-09-05T08:57:31Z")

</div>

Hi everyone,

My Discourse is 2.6.0.beta2 ( [5d7055779a](https://github.com/discourse/discourse/commits/5d7055779a6a95168dbe4d1a7af54c4492ab490e) )

I’m having problems trying to rebuild my Discourse via command line with a `./launcher rebuild app ` command.

It seems to go through the motions correctly, then exits with:

```plaintext
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.3.2/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/var/www/discourse/lib/tasks/db.rake:215:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2020-09-05T08:25:58.657559 #1] INFO -- : == 20200810053843 CreateDataExplorerQueries: migrating ========================
-- create_table(:data_explorer_queries)
   -> 0.0106s
-- create_table(:data_explorer_query_groups)
   -> 0.0094s
-- add_index(:data_explorer_query_groups, [:query_id, :group_id], {:unique=>true})
   -> 0.0027s

I, [2020-09-05T08:25:58.658141 #1] INFO -- : Terminating async processes
I, [2020-09-05T08:25:58.658212 #1] INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/12/bin/postmaster -D /etc/postgresql/12/main pid: 49
I, [2020-09-05T08:25:58.658286 #1] INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 166
166:signal-handler (1599294358) Received SIGTERM scheduling shutdown...
2020-09-05 08:25:58.659 UTC [49] LOG: received fast shutdown request
2020-09-05 08:25:58.660 UTC [49] LOG: aborting any active transactions
2020-09-05 08:25:58.666 UTC [49] LOG: background worker "logical replication launcher" (PID 58) exited with exit code 1
2020-09-05 08:25:58.667 UTC [53] LOG: shutting down
2020-09-05 08:25:58.683 UTC [49] LOG: database system is shut down
166:M 05 Sep 2020 08:25:58.719 # User requested shutdown...
166:M 05 Sep 2020 08:25:58.719 * Saving the final RDB snapshot before exiting.
166:M 05 Sep 2020 08:25:59.567 * DB saved on disk
166:M 05 Sep 2020 08:25:59.567 # Redis is now ready to exit, bye bye...

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 3035 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
5146d792aacf0286c008994c87539929db643cb326e686d9fb2a14095697b12b
**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.
```

The site still works (thankfully!).

If I remove the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) plugin then the site rebuilds correctly.

As soon as I add the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) back in to `app.yml` it fails to rebuild the site.

The relevant sections of my `app.yml` look like this:

```plaintext
## Plugins go here
## see https://meta.discourse.org/t/19157 for details
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/paviliondev/discourse-locations.git
          - git clone https://github.com/merefield/discourse-onebox-assistant.git
          - git clone https://github.com/discourse/discourse-data-explorer.git          
## Any custom commands to run after building
run:
  - exec: echo "Beginning of custom commands"
  ## If you want to set the 'From' email address
```

Any advice please?

---

<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: [September 5, 2020, 9:27am UTC](https://meta.discourse.org/t/unable-to-rebuild-app-possible-data-explorer-plugin-issue/163098/2 "2020-09-05T09:27:06Z")

</div>

Similar to?:

> [@Duplicate data explorer key blocking rebuild](https://meta.discourse.org/t/duplicate-data-explorer-key-blocking-rebuild/162375):
>
> Hey all, Rare I ask for help, but I’m puzzled about how to resolve this. Just rebuilt my site and getting this: discourse-data-explorer is already at latest compatible version I, [2020-08-28T17:53:57.578920 #1] INFO -- : \> cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' 2020-08-28 17:54:07.380 UTC [3060] discourse@discourse ERROR: duplicate key value violates unique constraint "data\_explorer\_queries\_pkey" 2020-08-28 17:54:07.380 UTC [3060] discourse@discourse DETAIL:…

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [September 5, 2020, 4:21pm UTC](https://meta.discourse.org/t/unable-to-rebuild-app-possible-data-explorer-plugin-issue/163098/3 "2020-09-05T16:21:00Z")

</div>

Possibly 🤔

If I run [the query you have there](https://meta.discourse.org/t/duplicate-data-explorer-key-blocking-rebuild/162375/4), I get these results:

 ![image](https://global.discourse-cdn.com/meta/original/3X/b/8/b850eebaf6a114143d4d20fadb8571e5ea8db2ee.png)

But to be perfectly honest, I’m way out of my depth here and don’t know if this is good or bad, nor, what to do next 😬

---

<div class="post-metadata">

### Author: ![Richie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/richie/32/115110_2.png) [@Richie](https://meta.discourse.org/u/Richie)
#### Post date: [September 6, 2020, 10:55am UTC](https://meta.discourse.org/t/unable-to-rebuild-app-possible-data-explorer-plugin-issue/163098/4 "2020-09-06T10:55:48Z")

</div>

> [@merefield](#):
>
> Similar to?

Identical - Thanks @merefield

Sure enough, I ran the query you shared in your other post and saw a few duplicated [data explorer](https://meta.discourse.org/t/32566?silent=true) queries.

I took the plunge and I did as you did, DELETEing the higher ID numbered ones, keeping the lower numbered ones in place.

Added the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) plugin back to my app.yml and it rebuilt perfectly with no issues or errors.

Thanks again 🙇‍♂️

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [October 6, 2020, 11:00am UTC](https://meta.discourse.org/t/unable-to-rebuild-app-possible-data-explorer-plugin-issue/163098/5 "2020-10-06T11:00:55Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
