Skip to content

Bundler fails to add platform-specific versions after starting with JRuby #9457

@skunkworker

Description

@skunkworker

Example Gemfile.lock

gem 'rake'

platforms :ruby do 
  gem 'pg'
end

# JRuby specific gems
platforms :jruby do
  # A JDBC-based ActiveRecord adapter for Postgres
  gem "activerecord-jdbcpostgresql-adapter", "~> 72"
  
  gem "jruby-openssl", "~> 0.15"
end

bundler: bundler 4.0.9

ruby: cruby 3.4.9

jruby: jruby-10.0.4.0

arch: macos 26.4

Describe the problem as clearly as you can

When starting with JRuby, then adding platform specific versions to the lockfile, an error is thrown. However if CRuby is the starting point, all platform specific gems can be added.

Did you try upgrading rubygems & bundler?

Yes, on latest rubygems and bundler 4.0.9

Post steps to reproduce the problem

Steps

  1. switch to cruby 3.4.9 rbenv local 3.4.9
  2. bundle install
  3. add platforms bundle lock --add-platform arm64-darwin x86_64-linux universal-java
  4. PLATFORMS should look like
PLATFORMS
  aarch64-linux
  aarch64-linux-musl
  arm64-darwin
  ruby
  universal-java
  x86_64-darwin
  x86_64-linux
  x86_64-linux-musl
  1. delete lock rm Gemfile.lock
  2. switch to JRuby rbenv local jruby-10.0.4.0
  3. add platforms bundle lock --add-platform arm64-darwin x86_64-linux universal-java
  4. blows up
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Could not find gem 'activerecord-jdbcpostgresql-adapter (~> 72) jruby' with
platform 'universal-java' in rubygems repository https://rubygems.org/ or
installed locally.

The source contains the following gems matching
'activerecord-jdbcpostgresql-adapter (~> 72) jruby':
  * activerecord-jdbcpostgresql-adapter-72.0-java
  * activerecord-jdbcpostgresql-adapter-72.1-java

Which command did you run?

bundle lock --add-platform arm64-darwin x86_64-linux universal-java

What were you expecting to happen?

The PLATFORMS should end up with the same list of platforms, however when using JRuby initially then adding platforms later, this blows up with an error.

What happened instead?

Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Could not find gem 'activerecord-jdbcpostgresql-adapter (~> 72) jruby' with
platform 'universal-java' in rubygems repository https://rubygems.org/ or
installed locally.

The source contains the following gems matching
'activerecord-jdbcpostgresql-adapter (~> 72) jruby':
  * activerecord-jdbcpostgresql-adapter-72.0-java
  * activerecord-jdbcpostgresql-adapter-72.1-java

If not included with the output of your command, run bundle env and paste the output below

## Environment

Bundler 4.0.9
Platforms ruby, universal-java
Ruby 3.4.5p0 (2026-03-03 revision 9af05b916fd07771a55f08d1ceb699ebf65a2d4d) [universal-java]
Full Path /Users/john/.rbenv/versions/jruby-10.0.4.0/bin/jruby
Config Dir /Users/john/.rbenv/versions/jruby-10.0.4.0/etc
RubyGems 4.0.9
Gem Home /Users/john/.rbenv/versions/jruby-10.0.4.0/lib/ruby/gems/shared
Gem Path /Users/john/.gem/jruby/3.4.0:/Users/john/.rbenv/versions/jruby-10.0.4.0/lib/ruby/gems/shared
User Home /Users/john
User Path /Users/john/.gem/jruby/3.4.0
Bin Dir /Users/john/.rbenv/versions/jruby-10.0.4.0/bin
Tools
Git 2.53.0
RVM not installed
rbenv rbenv 1.3.2
chruby not installed
Gem.ruby /Users/john/.rbenv/versions/jruby-10.0.4.0/bin/jruby
bundle #! /usr/bin/env jruby


## Bundler Build Metadata

Timestamp 2026-04-06
Git SHA 3ce4a32


## Bundler settings

build.nokogiri
Set for the current user (/Users/john/.bundle/config): "--use-system-libraries"
cache_all_platforms
Set for the current user (/Users/john/.bundle/config): true
gem.changelog
Set for the current user (/Users/john/.bundle/config): true
gem.ci
Set for the current user (/Users/john/.bundle/config): "gitlab"
gem.coc
Set for the current user (/Users/john/.bundle/config): false
gem.linter
Set for the current user (/Users/john/.bundle/config): "rubocop"
gem.mit
Set for the current user (/Users/john/.bundle/config): true
gem.push_key
Set for the current user (/Users/john/.bundle/config): "[REDACTED]"
gem.test
Set for the current user (/Users/john/.bundle/config): "rspec"
jobs
Set for the current user (/Users/john/.bundle/config): 8


## Gemfile

### Gemfile

```ruby
source 'https://rubygems.org'

gem 'rake'

platforms :ruby do
  gem 'pg'
end

# JRuby specific gems
platforms :jruby do
  # A JDBC-based ActiveRecord adapter for Postgres
  gem "activerecord-jdbcpostgresql-adapter", "~> 72"

  gem "jruby-openssl", "~> 0.15"
end

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    activemodel (7.2.3.1)
      activesupport (= 7.2.3.1)
    activerecord (7.2.3.1)
      activemodel (= 7.2.3.1)
      activesupport (= 7.2.3.1)
      timeout (>= 0.4.0)
    activerecord-jdbc-adapter (72.1-java)
      activerecord (~> 7.2.2)
    activerecord-jdbcpostgresql-adapter (72.1-java)
      activerecord-jdbc-adapter (= 72.1)
      jdbc-postgres (>= 9.4, < 43)
    activesupport (7.2.3.1)
      base64
      benchmark (>= 0.3)
      bigdecimal
      concurrent-ruby (~> 1.0, >= 1.3.1)
      connection_pool (>= 2.2.5)
      drb
      i18n (>= 1.6, < 2)
      logger (>= 1.4.2)
      minitest (>= 5.1, < 6)
      securerandom (>= 0.3)
      tzinfo (~> 2.0, >= 2.0.5)
    base64 (0.3.0)
    benchmark (0.5.0)
    bigdecimal (4.1.1-java)
    concurrent-ruby (1.3.6)
    connection_pool (3.0.2)
    drb (2.2.3)
    i18n (1.14.8)
      concurrent-ruby (~> 1.0)
    jdbc-postgres (42.7.8)
    jruby-openssl (0.15.7-java)
    logger (1.7.0)
    minitest (5.27.0)
    rake (13.3.1)
    securerandom (0.4.1)
    timeout (0.6.1)
    tzinfo (2.0.6)
      concurrent-ruby (~> 1.0)

PLATFORMS
  universal-java

DEPENDENCIES
  activerecord-jdbcpostgresql-adapter (~> 72)
  jruby-openssl (~> 0.15)
  pg
  rake

CHECKSUMS
  activemodel (7.2.3.1) sha256=39e1869b85e7a0b64a8ccddf19f3fb0c44261b329785384bb88f878eab51c0d0
  activerecord (7.2.3.1) sha256=b89513e275da5b34183c5f2a497c154b02dcc7c811d399ab557e67e36170a05d
  activerecord-jdbc-adapter (72.1-java) sha256=4487cb4606b5d76913b5abaaf681ef21b7aa9478ed201918f48da6b3f7fcec70
  activerecord-jdbcpostgresql-adapter (72.1-java) sha256=1f71c5765b43744148fe955cb86350a75d41eb9d747d3e7b5b5698948187962a
  activesupport (7.2.3.1) sha256=11ebed516a43a0bb47346227a35ebae4d9427465a7c9eb197a03d5c8d283cb34
  base64 (0.3.0) sha256=27337aeabad6ffae05c265c450490628ef3ebd4b67be58257393227588f5a97b
  benchmark (0.5.0) sha256=465df122341aedcb81a2a24b4d3bd19b6c67c1530713fd533f3ff034e419236c
  bigdecimal (4.1.1-java) sha256=e24608009454797cd8705be60bd451716fc15a8065ce217aa7c8ac8fe8018856
  concurrent-ruby (1.3.6) sha256=6b56837e1e7e5292f9864f34b69c5a2cbc75c0cf5338f1ce9903d10fa762d5ab
  connection_pool (3.0.2) sha256=33fff5ba71a12d2aa26cb72b1db8bba2a1a01823559fb01d29eb74c286e62e0a
  drb (2.2.3) sha256=0b00d6fdb50995fe4a45dea13663493c841112e4068656854646f418fda13373
  i18n (1.14.8) sha256=285778639134865c5e0f6269e0b818256017e8cde89993fdfcbfb64d088824a5
  jdbc-postgres (42.7.8) sha256=4f909ede87f6482af7f6b71353a914cc0b7c28f5db65c5af139d690cf338bc1e
  jruby-openssl (0.15.7-java) sha256=dcaa7aff243223bc860f16611ef9f8acebda1f84a4c6e3b4f0dca83476a972c8
  logger (1.7.0) sha256=196edec7cc44b66cfb40f9755ce11b392f21f7967696af15d274dde7edff0203
  minitest (5.27.0) sha256=2d3b17f8a36fe7801c1adcffdbc38233b938eb0b4966e97a6739055a45fa77d5
  rake (13.3.1) sha256=8c9e89d09f66a26a01264e7e3480ec0607f0c497a861ef16063604b1b08eb19c
  securerandom (0.4.1) sha256=cc5193d414a4341b6e225f0cb4446aceca8e50d5e1888743fac16987638ea0b1
  timeout (0.6.1) sha256=78f57368a7e7bbadec56971f78a3f5ecbcfb59b7fcbb0a3ed6ddc08a5094accb
  tzinfo (2.0.6) sha256=8daf828cc77bcf7d63b0e3bdb6caa47e2272dcfaf4fbfe46f8c3a9df087a829b

BUNDLED WITH
  4.0.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions