Skip to content

Checksums cannot be parsed due to errant carriage returns on JRuby/Windows #8988

@chadlwilson

Description

@chadlwilson

Describe the problem as clearly as you can

When trying to use bundler on JRuby/Windows, installs are failing due to issues parsing the checksums for specs off the compact index (I think). There seem to be errant carriage returns in the response that are unexpected and cannot be parsed.

Did you try upgrading rubygems & bundler?

Yes.

  • Bundler 2.7.2 via JRuby 10.0
  • Bundler 2.6.9 via JRuby 9.4

Post steps to reproduce the problem

  • Installed JRuby via Windows installer
  • gem update --system if necessary (although same problem with default jruby bundler versions)
  • Try and install gems with bundler via jruby, or use the reprod below

Which command did you run?

jruby -rbundler -e "p Bundler::Fetcher.new(Bundler::Source::Rubygems::Remote.new(Gem::URI('https://rubygems.org'))).specs(['test-unit'], Bundler::Source::Rubygems.new)"

(or alternatively installing anything via Bundler with checksum validation enabled)

What were you expecting to happen?

Gems install, or alternatively via the slim reprod, output like

.......#<Bundler::Index:0x4008 sources=[] specs.size=20>

What happened instead?

PS C:\Users\chad> ruby -rbundler -e "p Bundler::Fetcher.new(Bundler::Source::Rubygems::Remote.new(Gem::URI('https://rubygems.org'))).specs(['test-unit'], Bundler::Source::Rubygems.new)"
.......Bundler::GemspecError: There was an error parsing the metadata for the gem test-unit (3.6.9): ArgumentError
Invalid checksum for test-unit-3.6.9: "2be6ae0354623702f004ae626c98337f5e17f2ecc0fc334a9e6fdbb2c7c534da\r" is not a valid SHA256 hex or base64 digest
The metadata was [["checksum", ["2be6ae0354623702f004ae626c98337f5e17f2ecc0fc334a9e6fdbb2c7c534da\r"]]]
  parse_metadata at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/endpoint_specification.rb:167
      initialize at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/endpoint_specification.rb:25
           specs at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/fetcher.rb:144
            each at org/jruby/RubyArray.java:2088
           specs at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/fetcher.rb:142
          <main> at -e:1
ArgumentError: Invalid checksum for test-unit-3.6.9: "2be6ae0354623702f004ae626c98337f5e17f2ecc0fc334a9e6fdbb2c7c534da\r" is not a valid SHA256 hex or base64 digest
  parse_metadata at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/endpoint_specification.rb:158
            each at org/jruby/RubyArray.java:2088
  parse_metadata at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/endpoint_specification.rb:151
      initialize at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/endpoint_specification.rb:25
           specs at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/fetcher.rb:144
            each at org/jruby/RubyArray.java:2088
           specs at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/fetcher.rb:142
          <main> at -e:1
ArgumentError: "2be6ae0354623702f004ae626c98337f5e17f2ecc0fc334a9e6fdbb2c7c534da\r" is not a valid SHA256 hex or base64 digest
    to_hexdigest at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/checksum.rb:50
        from_api at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/checksum.rb:34
  parse_metadata at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/endpoint_specification.rb:156
            each at org/jruby/RubyArray.java:2088
  parse_metadata at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/endpoint_specification.rb:151
      initialize at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/endpoint_specification.rb:25
           specs at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/fetcher.rb:144
            each at org/jruby/RubyArray.java:2088
           specs at C:/jruby-10.0.2.0/lib/ruby/stdlib/bundler/fetcher.rb:142
          <main> at -e:1

Environment

Via

ruby -rbundler -e "p Bundler::Fetcher.new(Bundler::Source::Rubygems::Remote.new(Gem::URI('https://rubygems.org'))).user_agent"
"bundler/2.7.2 rubygems/3.7.2 ruby/3.4.2 (aarch64-Microsoft-mswin32) command/ jruby/10.0.2.0 options/ 5bb2f02785a0e209"
Bundler       2.7.2
  Platforms   ruby, universal-java-21
Ruby          3.4.2p0 (2025-08-07 revision cba6031bd0c7f7372c69fececce438cad3c77ab0) [universal-java-21]
  Full Path   C:/jruby-10.0.2.0/bin/jruby.exe
  Config Dir  C:/jruby-10.0.2.0/etc
RubyGems      3.7.2
  Gem Home    C:/jruby-10.0.2.0/lib/ruby/gems/shared
  Gem Path    C:\Users\chad/.local/share/gem/jruby/3.4.0;C:/jruby-10.0.2.0/lib/ruby/gems/shared
  User Home   C:\Users\chad
  User Path   C:\Users\chad/.local/share/gem/jruby/3.4.0
  Bin Dir     C:/jruby-10.0.2.0/bin
Tools
  Git         2.51.0.windows.1
  RVM         not installed
  rbenv       not installed
  chruby      not installed

Bundler Build Metadata

Timestamp  2025-09-09
Git SHA    b463ced1459

Workaround

bundle config set --local disable_checksum_validation true

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions