# AI Plugin Build Error - 'bundle exec rake db:migrate' failed

**URL:** <https://meta.discourse.org/t/ai-plugin-build-error-bundle-exec-rake-db-migrate-failed/288104>\
**Category:** Self-hosting\
**Tags:** ai\
**Created:** [December 10, 2023, 12:05am UTC](https://meta.discourse.org/t/ai-plugin-build-error-bundle-exec-rake-db-migrate-failed/288104 "2023-12-10T00:05:17Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![dfriestedt](https://avatars.discourse-cdn.com/v4/letter/d/a698b9/32.png) [@dfriestedt](https://meta.discourse.org/u/dfriestedt)\
**Post date:** [December 10, 2023, 12:05am UTC](https://meta.discourse.org/t/ai-plugin-build-error-bundle-exec-rake-db-migrate-failed/288104/1 "2023-12-10T00:05:17Z")

</div>

I recently tried to install the [AI plugin](https://meta.discourse.org/t/enable-ai-bot/266012) and got the following error on build.

```plaintext

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 3637 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
**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.
4360a80a0b05dee80d7e147d6e7618b2436c71fa03d7c04422dc285b551134d9

```

What action do you recommend I take to remedy this error?

I saw a few relevant posts.

This one did not have a solution

> [@Error when updating Discourse to latest version - potential db:migrate issue](https://meta.discourse.org/t/error-when-updating-discourse-to-latest-version-potential-db-migrate-issue/219895):
>
> We’re seeing the following error in our logs when attempting to update our instance of Discourse to the latest version: FAILED -------------------- Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #\<Process::Status: pid 5195 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'"]} \*\* FAILED TO BOOT…

This one had a solution but seemed to be related to an older version of postgres which I don’t have.

> [@Failed To Bootstrap Pups::ExecError 'bundle exec rake db:migrate' failed with return exec failed with the params 2.9.0.beta4 to 2.9.0.beta5](https://meta.discourse.org/t/failed-to-bootstrap-pups-execerror-bundle-exec-rake-db-migrate-failed-with-return-exec-failed-with-the-params-2-9-0-beta4-to-2-9-0-beta5/229753):
>
> I upgrade my discourse two months ago to 2.9.0.beta4 [34fba417f1](https://github.com/discourse/discourse/commits/34fba417f1435035b0d3c4763a826a79c25a87f1). Unfortunately, I forgot to recheck my Upgrade page for ./launcher rebuild app. When I try to rebuild in last two days ago, my disc space is insufficient. My backups is 130 MB. So, upgrade my droplet and resize into 50 GB from 25 GB. This error occur when I tried to rebuild the app. 102:M 11 Jun 2022 13:40:32.373 \* DB saved on disk 102:M 11 Jun 2022 13:40:32.374 # Redis is now ready to exit, bye bye... FAILED ---------------…

Another that seemed related, but not completely

> [@Failed To Bootstrap Pups::ExecError 'bundle exec rake db:migrate' failed with return exec failed with the params 2.9.0.beta4 to 2.9.0.beta5](https://meta.discourse.org/t/failed-to-bootstrap-pups-execerror-bundle-exec-rake-db-migrate-failed-with-return-exec-failed-with-the-params-2-9-0-beta4-to-2-9-0-beta5/229753/4):
>
> Someone had a similar error recently too - [Unable to restore/update discourse (PG::InvalidTextRepresentation: ERROR: invalid input syntax for type integer: "[]")](https://meta.discourse.org/t/unable-to-restore-update-discourse-pg-error-invalid-input-syntax-for-type-integer/229828), which was due to some stray data in the selectable\_avatar site setting field blocking its migration. There is a manual workaround using the rails console, however you do need to be comfortable using the rails console. If the rails console is out of your comfort zone, @david did mention creating an automatic tweak if there were any mo…

---

_[View the full topic](https://meta.discourse.org/t/ai-plugin-build-error-bundle-exec-rake-db-migrate-failed/288104)._
