ruby/rubygems · error · Gem::InstallError
extension outside of gem root
Error message
extension outside of gem root
What it means
Error "extension outside of gem root" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/ext/cargo_builder.rb:110
cmd += [*cargo_rustc_args(dest_path, crate_name)]
cmd
end
private
def cargo
ENV.fetch("CARGO", "cargo")
end
# returns the directory nesting of the extension, ignoring the first part, so
# "ext/foo/bar/Cargo.toml" becomes "foo/bar"
def extension_nesting(extension)
parts = extension.to_s.split(Regexp.union([File::SEPARATOR, File::ALT_SEPARATOR].compact))
parts = parts.each_with_object([]) do |segment, final|
next if segment == "."
if segment == ".."
raise Gem::InstallError, "extension outside of gem root" if final.empty?
next final.pop
end
final << segment
end
File.join(parts[1...-1])
end
def rb_config_env
result = {}
RbConfig::CONFIG.each {|k, v| result["RBCONFIG_#{k}"] = v }
result
end
def cargo_rustc_args(dest_dir, crate_name)
[
*linker_args,
*mkmf_libpath,View on GitHub (pinned to 86cbb817a3)
When it happens
Trigger: Thrown at lib/rubygems/ext/cargo_builder.rb:110 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23).
Data as JSON: /api/errors/2308aa88d41b7f9a.
Report an issue: GitHub.