Rebuild Failed: bootstrap failed with exit code 137

AI-generated summary

Users are troubleshooting a Discourse rebuild failure with exit code 137, which typically indicates an out-of-memory issue. isubbu initially reported the error after removing plugins without success. pfaffman correctly identified the cause as insufficient RAM or swap space, advising to add either. isubbu confirmed this fix resolved their issue. znedw shared a workaround: rebooting the system before rebuilding, which also worked for them. pfaffman endorsed rebooting as a good practice and suggested adding swap as a simpler alternative if disk space permits. sheng_hualuo offered an additional insight: manually allocating RAM for Docker via ./discourse-setup (then canceling it) before restoring a backup and rebuilding can resolve the issue, even if RAM isn’t technically insufficient. The consensus is that memory constraints — whether RAM, swap, or Docker allocation — are the root cause, and multiple solutions exist depending on the environment.

I get the following error when trying to rebuild. Saw similar thread in here and removed some plugins but that didnt resolve the issue

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake assets:precompile:build' failed with return #<Process::Status: pid 666 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "tag"=>"build", "hook"=>"assets_precompile_build", "cmd"=>["su discourse -c 'bundle exec rake assets:precompile:build'"]}
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.
4490985a65ce2bcadfb9a4dbf82c674b9fd999dc32d42cc9e7c3c265f73c9c6c

Full log attached
rebuild_log.txt (39.6 KB)

137 is is out memory. Add memory (ram) or add swap.

Thanks for the suggestion, it worked. Site is back online!

I had this earlier, I usually do package updates and reboot before rebuilding but I didn’t this time.

Rebooted and rebuild worked straight away, must have been just enough.

Not a bad idea! Adding a bit more swap seems easier if you can spare the disk space.

I’ve encountered this problem, sometimes it’s not the problem that the RAM memory is too small, it should be caused by it not manually allocating RAM for docker, before restoring your website backup, you must first execute the ./discourse-setup command, and then he will automatically allocate memory for Docker, and then you can ctrl + C to terminate the command, upload the backup app.yml proceed ./launcher rebuild app