{"record":{"id":"2308aa88d41b7f9a","repo":"ruby/rubygems","slug":"extension-outside-of-gem-root","errorCode":null,"errorMessage":"extension outside of gem root","messagePattern":"extension outside of gem root","errorType":"exception","errorClass":"Gem::InstallError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/ext/cargo_builder.rb","lineNumber":110,"sourceCode":"    cmd += [*cargo_rustc_args(dest_path, crate_name)]\n    cmd\n  end\n\n  private\n\n  def cargo\n    ENV.fetch(\"CARGO\", \"cargo\")\n  end\n\n  # returns the directory nesting of the extension, ignoring the first part, so\n  # \"ext/foo/bar/Cargo.toml\" becomes \"foo/bar\"\n  def extension_nesting(extension)\n    parts = extension.to_s.split(Regexp.union([File::SEPARATOR, File::ALT_SEPARATOR].compact))\n\n    parts = parts.each_with_object([]) do |segment, final|\n      next if segment == \".\"\n      if segment == \"..\"\n        raise Gem::InstallError, \"extension outside of gem root\" if final.empty?\n        next final.pop\n      end\n      final << segment\n    end\n\n    File.join(parts[1...-1])\n  end\n\n  def rb_config_env\n    result = {}\n    RbConfig::CONFIG.each {|k, v| result[\"RBCONFIG_#{k}\"] = v }\n    result\n  end\n\n  def cargo_rustc_args(dest_dir, crate_name)\n    [\n      *linker_args,\n      *mkmf_libpath,","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/ext/cargo_builder.rb#L92-L128","documentation":"Error \"extension outside of gem root\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/ext/cargo_builder.rb:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"86cbb817a38ce8477b181c17467a703ded3f2be8","analyzedAt":"2026-08-23T06:27:48.159Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}