# "Zlib::BufError: buffer error" - Discourse update fails

**URL:** https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347
**Category:** Self-hosting
**Created:** [June 10, 2024, 6:53am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347 "2024-06-10T06:53:31Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![AquaL1te](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aqual1te/32/201966_2.png) [@AquaL1te](https://meta.discourse.org/u/AquaL1te)
#### Post date: [June 10, 2024, 6:53am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/1 "2024-06-10T06:53:31Z")

</div>

```plaintext
Plugin name is 'discourse-education-group-custom-fields', but plugin directory is named 'discourse-group-custom-fields' 
Purging temp files                                     
Bundling assets                                           
I, [2024-06-10T06:41:22.964825 #1211] INFO -- : Writing /var/www/discourse/public/assets/break_string-cc617154cd957804f2f6a1f3bc68258c9cdca3d4b9a322bf777d145fed04790e.js
I, [2024-06-10T06:41:22.986328 #1211] INFO -- : Writing /var/www/discourse/public/assets/service-worker-5ed284060464db53e2bfcd15aca57982a183382ef3e0c86921be9a2ac5ecc196.js
I, [2024-06-10T06:41:22.993446 #1211] INFO -- : Writing /var/www/discourse/public/assets/locales/i18n-3b40e842fd72b9bcc74ea83e094c823cd9ca535e4ecc5e78722e6f99d3656137.js
I, [2024-06-10T06:41:22.997323 #1211] INFO -- : Writing /var/www/discourse/public/assets/scripts/discourse-test-listen-boot-9b14a0fc65c689577e6a428dcfd680205516fe211700a71c7adb5cbcf4df2cc5.js
rake aborted!                                                                                                          
Zlib::BufError: buffer error (Zlib::BufError)                                                                          
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cache/file_store.rb:100:in `<<'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cache/file_store.rb:100:in `set'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/sprockets-3.7.3/lib/sprockets/cache.rb:212:in `set'

...

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 1209 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"=>"precompile", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'SKIP_EMBER_CLI_COMPILE=1 bundle exec rake themes:update assets:precompile'"]}
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.

```

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 10, 2024, 6:59am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/2 "2024-06-10T06:59:39Z")

</div>

There have been a couple of reports of a similar error recently:

[Cannot build on arm, Zlib::BufError during assets:precompile](https://meta.discourse.org/t/cannot-build-on-arm-zlib-buferror-during-assets-precompile/309300)  
[Rebuild fails when these plugins are present](https://meta.discourse.org/t/rebuild-fails-when-these-plugins-are-present/310455)

Not sure if an exact cause has been found, but one was thought to be Animated Avatars and the other Subscriptions (though Subscriptions has been rebuilding fine for me).

---

<div class="post-metadata">

### Author: ![AquaL1te](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aqual1te/32/201966_2.png) [@AquaL1te](https://meta.discourse.org/u/AquaL1te)
#### Post date: [June 10, 2024, 7:18am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/3 "2024-06-10T07:18:03Z")

</div>

> [@JammyDodger](#):
>
> Animated Avatars and the other Subscriptions

I don’t use those plugins:

```plaintext
   2 │ discourse_plugins:
   3 │ - https://github.com/discourse/docker_manager
   4 │ - https://github.com/discourse/discourse-rss-polling
   5 │ - https://github.com/discourse/discourse-chat-integration
   6 │ - https://github.com/discourse/discourse-yearly-review
   7 │ - https://github.com/discourse/discourse-perspective-api
   8 │ - https://github.com/discourse/discourse-policy
   9 │ - https://github.com/discourse/discourse-shared-edits
  10 │ - https://github.com/discourse/discourse-akismet
  11 │ - https://github.com/discourse/discourse-solved
  12 │ - https://github.com/discourse/discourse-user-notes
  13 │ - https://github.com/discourse/discourse-templates
  14 │ - https://github.com/discourse/discourse-assign
  15 │ - https://github.com/discourse/discourse-docs
  16 │ - https://github.com/discourse/discourse-encrypt
  17 │ - https://github.com/discourse/discourse-cakeday
  18 │ - https://github.com/discourse/discourse-calendar
  19 _ │ - https://github.com/discourse/discourse-data-explorer
  20 │ - https://github.com/kees-closed/discourse-group-custom-fields
  21 │ - https://github.com/discourse/discourse-activity-pub

```

I do use MaxMind, so maybe [that might be the issue](https://meta.discourse.org/t/cannot-build-on-arm-zlib-buferror-during-assets-precompile/309300/5). I also commented out the non-Discourse plugin. That didn’t solve the issue, so I don’t think it is due to a non-official plugin.

I also rebooted the container host, no effect on the build outcome. In the past a networking issue was resolved by a reboot.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [June 10, 2024, 2:46pm UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/4 "2024-06-10T14:46:24Z")

</div>

> [@AquaL1te](#):
>
> I do use MaxMind,

Did you try rebuilding without it?

My best explanation for this right now is some spurious error with Maxmind. But looking again at some of the errors that doesn’t make sense either.

---

<div class="post-metadata">

### Author: ![DeanMarkTaylor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/deanmarktaylor/32/102462_2.png) [@DeanMarkTaylor](https://meta.discourse.org/u/DeanMarkTaylor)
#### Post date: [June 13, 2024, 2:43am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/5 "2024-06-13T02:43:06Z")

</div>

I’ve just had this issue when updating a Discourse install…

I believe the cause is because when `DISCOURSE_MAXMIND_LICENSE_KEY` is specified in the `.yml` container file without a corresponding `DISCOURSE_MAXMIND_ACCOUNT_ID`.

@tgxworld’s pull request adds the use of `DISCOURSE_MAXMIND_ACCOUNT_ID` in multiple places and explains the need for “Account ID”:  
[https://github.com/discourse/discourse\_docker/pull/796](https://github.com/discourse/discourse_docker/pull/796)

For me the fix was adding `DISCOURSE_MAXMIND_ACCOUNT_ID` and rebuilding (I rebuilt twice, but this was most likely a temporary issue).

---

<div class="post-metadata">

### Author: ![AquaL1te](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/aqual1te/32/201966_2.png) [@AquaL1te](https://meta.discourse.org/u/AquaL1te)
#### Post date: [June 13, 2024, 7:32am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/6 "2024-06-13T07:32:30Z")

</div>

A recent rebuild worked fine. If it fails again I’ll have a look at @DeanMarkTaylor his suggestion. Thanks everyone!

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 13, 2024, 11:10am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/7 "2024-06-13T11:10:21Z")

</div>

FWIW I just hit the `Zlib::BufError: buffer error (Zlib::BufError) ` rebuild error and adding in the `DISCOURSE_MAXMIND_ACCOUNT_ID` and rebuilding went through first time for me. 👍

---

<div class="post-metadata">

### Author: ![Roi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/roi/32/130587_2.png) [@Roi](https://meta.discourse.org/u/Roi)
#### Post date: [June 26, 2024, 5:10pm UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/8 "2024-06-26T17:10:39Z")

</div>

Same here. Adding the account ID and rebuilding is working again. 🙂

---

<div class="post-metadata">

### Author: ![mcdanlj](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mcdanlj/32/131829_2.png) [@mcdanlj](https://meta.discourse.org/u/mcdanlj)
#### Post date: [July 11, 2024, 1:28am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/9 "2024-07-11T01:28:19Z")

</div>

When the 3.3.0.beta3 version was released, I got this error inconsistently; it failed once, and then the rebuild succeeded. (Not having found this post, I worried about memory corruption! 😬) Tonight, doing a rebuild, it consistently failed until I found this post and added `DISCOURSE_MAXMIND_ACCOUNT_ID` to the existing `DISCOURSE_MAXMIND_LICENSE_KEY` and then it reliably succeeded.

(I assume something like that maxmind rolled out a change with a blue/green deployment and that earlier I hit different versions of a back end service each time…)

---

<div class="post-metadata">

### Author: ![Jagster](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jagster/32/192154_2.png) [@Jagster](https://meta.discourse.org/u/Jagster)
#### Post date: [July 21, 2024, 1:36pm UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/10 "2024-07-21T13:36:55Z")

</div>

Rebuilding just failed because of MaxMind lines. It worked until now, and without any changes in app.yml it failed now. So something bigger is broken.

What ever, I don’t need it under Discourse, so I let it be commented. But it is totally sure the issue is something else than just account\_id.

---

<div class="post-metadata">

### Author: ![Gunnar](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gunnar/32/119647_2.png) [@Gunnar](https://meta.discourse.org/u/Gunnar)
#### Post date: [July 25, 2024, 7:01am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/11 "2024-07-25T07:01:56Z")

</div>

> [@Jagster](#):
>
> So something bigger is broken.

Agreed. My rebuild failed even with `DISCOURSE_MAXMIND_ACCOUNT_ID` set in app.yml.

As soon as I commented out all mention of Maxmind, the rebuild succeeded.

---

<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: [August 24, 2024, 7:02am UTC](https://meta.discourse.org/t/zlib-buffer-error-discourse-update-fails/311347/12 "2024-08-24T07:02:38Z")

</div>

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