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

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'


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.

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

Cannot build on arm, Zlib::BufError during assets:precompile
Rebuild fails when these plugins are present

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).


I don’t use those plugins:

   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. 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.

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.

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”:

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


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

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. :+1: