ruby/rubygems · error · Gem::Package::PathError
installing into parent path %s of %s is not allowed
Error message
installing into parent path %s of %s is not allowed
What it means
Error "installing into parent path %s of %s is not allowed" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/package.rb:651
@spec = nil
@files = []
raise
rescue Errno::ENOENT => e
raise Gem::Package::FormatError.new e.message
rescue Zlib::GzipFile::Error, EOFError, Gem::Package::TarInvalidError => e
raise Gem::Package::FormatError.new e.message, @gem
end
private
##
# Returns the full path for installing +filename+ into +destination_dir+,
# which must already be resolved with File.realpath by the caller.
#
# If +filename+ is not inside +destination_dir+ an exception is raised.
def install_location(filename, destination_dir) # :nodoc:
raise Gem::Package::PathError.new(filename, destination_dir) if
filename.start_with? "/"
destination = File.expand_path(filename, destination_dir)
raise Gem::Package::PathError.new(destination, destination_dir) unless
normalize_path(destination).start_with? normalize_path(destination_dir + "/")
destination
end
##
# Raises an exception unless +dir+, with symlinks resolved, is
# +destination_dir+ or a directory inside it. +destination_dir+ must
# already be resolved with File.realpath by the caller.
def verify_extraction_dir(dir, destination_dir) # :nodoc:
real_dir = File.realpath(dir)
View on GitHub (pinned to 86cbb817a3)
Solutions
- Do not install this package: it contains an entry that would write outside the install directory
- If you built the gem, fix the file list to remove parent-path entries and rebuild
When it happens
Trigger: Thrown at lib/rubygems/package.rb:651 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/be6ca3b951511e79.
Report an issue: GitHub.