{"record":{"id":"ed81b527a09da8f0","repo":"ruby/ruby","slug":"unknown-ruby-ruby-engine","errorCode":null,"errorMessage":"Unknown Ruby: #{RUBY_ENGINE}","messagePattern":"Unknown Ruby: #(.+?)","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"ext/strscan/lib/strscan.rb","lineNumber":19,"sourceCode":"# frozen_string_literal: true\n\ncase RUBY_ENGINE\nwhen 'ruby'\n  require 'strscan.so'\n  require_relative 'strscan/strscan'\nwhen 'jruby'\n  require 'strscan.jar'\n  JRuby::Util.load_ext('org.jruby.ext.strscan.StringScannerLibrary')\n  require_relative 'strscan/strscan'\nwhen 'truffleruby'\n  if RUBY_ENGINE_VERSION.to_i >= 34\n    require 'strscan/truffleruby'\n  else\n    $LOAD_PATH.delete __dir__\n    require 'strscan'\n  end\nelse\n  raise NotImplementedError, \"Unknown Ruby: #{RUBY_ENGINE}\"\nend\n","sourceCodeStart":1,"sourceCodeEnd":21,"githubUrl":"https://github.com/ruby/ruby/blob/0e5b888e1c355f3f728f2659f085820937dada48/ext/strscan/lib/strscan.rb#L1-L21","documentation":"NotImplementedError raised by the strscan gem's ruby-side loader (lib/strscan.rb:19) when RUBY_ENGINE is neither 'ruby' (MRI), 'jruby', nor 'truffleruby'. The gem selects a per-engine native implementation (C ext, strscan.jar, or truffleruby bindings); an unrecognized engine means no implementation exists, so requiring 'strscan' fails immediately.","triggerScenarios":"Requiring the strscan gem source under an exotic engine (e.g. rbx/Rubinius relics, opal, mruby-based runtimes); a bundler setup that forces the ruby-platform variant of the gem (force_ruby_platform: true) on an engine the gem does not know; vendoring the gem into a custom embedded Ruby build whose RUBY_ENGINE was renamed.","commonSituations":"Custom/compiled Ruby distributions that report a nonstandard RUBY_ENGINE; opal or transpiled-browser environments; switching a project to an experimental engine while gems still pin the C-ext gem rather than a pure-Ruby alternative.","solutions":["Run under a supported engine: MRI (ruby), JRuby (>= the gem's required version), or TruffleRuby","For JRuby with an old engine version, upgrade past the version gate in the loader so the strscan.jar path is taken","On unsupported engines, depend on a pure-Ruby replacement or vendor a scanner implemented with Regexp instead of the strscan gem","If you maintain a forked engine, add a branch for your RUBY_ENGINE or set it to report 'ruby' only if the C ABI truly matches"],"exampleFix":"# before (Gemfile forces native gem on an unsupported engine)\ngem 'strscan', force_ruby_platform: true # require 'strscan' => NotImplementedError under exotic engine\n\n# after\ngem 'strscan' # let bundler pick the precompiled platform gem for MRI/JRuby/TruffleRuby\n# or, on unsupported engines, avoid strscan:\nclass SimpleScanner\n  def initialize(s) = (@s = s)\n  def scan(re) = (@s.slice!(/\\A#{re}/))\nend","handlingStrategy":"type-guard","validationCode":"unless %w[ruby jruby truffleruby].include?(RUBY_ENGINE)\n  abort \"strscan unsupported on #{RUBY_ENGINE}\"\nend\nrequire 'strscan'","typeGuard":"def strscan_supported? = %w[ruby jruby truffleruby].include?(RUBY_ENGINE)","tryCatchPattern":"begin\n  require 'strscan'\nrescue NotImplementedError\n  require_relative 'my_fallback_scanner' # pure-Ruby regex-based scanner\nend","preventionTips":["Let bundler choose the platform gem instead of force_ruby_platform on exotic engines","Gate engine-specific gems in the Gemfile with explicit platforms blocks","For custom Ruby builds, verify RUBY_ENGINE reports a supported value before shipping the strscan gem"],"tags":["strscan","ruby-engine","compatibility","not-implemented"],"backgroundTag":"unsupported-runtime-engine","analyzedSha":"0e5b888e1c355f3f728f2659f085820937dada48","analyzedAt":"2026-08-21T14:25:43.473Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}