{"record":{"id":"473f51b95e095c23","repo":"ruby/ruby","slug":"the-path-expanded-path-does-not-exist","errorCode":null,"errorMessage":"The path `#{expanded_path}` does not exist.","messagePattern":"The path `#(.+?)` does not exist\\.","errorType":"exception","errorClass":"Bundler::PathError","httpStatus":null,"severity":"error","filePath":"lib/bundler/source/path.rb","lineNumber":204,"sourceCode":"              s.platform = Gem::Platform::RUBY\n              s.summary  = \"Fake gemspec for #{@name}\"\n              s.relative_loaded_from = \"#{@name}.gemspec\"\n              s.authors = [\"no one\"]\n              if expanded_path.join(\"bin\").exist?\n                executables = expanded_path.join(\"bin\").children\n                executables.reject! {|p| File.directory?(p) }\n                s.executables = executables.map {|c| c.basename.to_s }\n              end\n            end\n          end\n        else\n          message = String.new(\"The path `#{expanded_path}` \")\n          message << if File.exist?(expanded_path)\n            \"is not a directory.\"\n          else\n            \"does not exist.\"\n          end\n          raise PathError, message\n        end\n\n        index\n      end\n\n      def relative_path(path = self.path)\n        if path.to_s.start_with?(root_path.to_s)\n          return path.relative_path_from(root_path)\n        end\n        path\n      end\n\n      def generate_bin(spec, options = {})\n        gem_dir = Pathname.new(spec.full_gem_path)\n\n        # Some gem authors put absolute paths in their gemspec\n        # and we have to save them from themselves\n        spec.files = spec.files.filter_map do |path|","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/ruby/ruby/blob/0e5b888e1c355f3f728f2659f085820937dada48/lib/bundler/source/path.rb#L186-L222","documentation":"Raised from Bundler::Source::Path#specs when the expanded path for a `:path` gem source simply does not exist on disk (File.exist? is false, the sibling branch of the 'is not a directory' case). The Gemfile references a location that is not present on this machine, so Bundler cannot load any gemspec from it.","triggerScenarios":"`gem \"foo\", path: \"../foo\"` when ../foo has not been cloned yet; git submodules holding the gem not initialized; case-sensitive path mismatch (\"Foo\" vs \"foo\") moving projects between macOS and Linux; relative paths written against a different base directory than the Gemfile's location.","commonSituations":"Fresh clone where `git clone --recursive` was forgotten; a teammate moved or renamed the folder and committed the Gemfile update but not the folder; monorepo checkouts missing sibling repos; wrong-case paths that worked on case-insensitive filesystems and fail in CI/Docker on Linux.","solutions":["Check the expanded location relative to the Gemfile's directory and fix the typo, case, or relative level in the :path value","Clone or restore the missing directory (e.g. `git submodule update --init --recursive`)","If the gem lives elsewhere on this machine, use an absolute path or set a local override: `bundle config local.foo /abs/path/to/foo`","Add a quick Gemfile-time guard so the failure names the bad path immediately"],"exampleFix":"# before\ngem \"foo\", path: \"../common/foo\"\n\n# after\ngem \"foo\", path: \"../libs/foo\"","handlingStrategy":"validation","validationCode":"# Ensure every :path source exists relative to the Gemfile before installing\nrequire \"bundler\"\nbase = File.dirname(Bundler.default_gemfile)\npath_gems.each do |name, rel|\n  abs = File.expand_path(rel, base)\n  abort \"#{name}: path #{abs} does not exist\" unless File.directory?(abs)\nend","typeGuard":null,"tryCatchPattern":"begin\n  Bundler::Installer.install(Bundler.root, Bundler.definition)\nrescue Bundler::PathError => e\n  raise unless e.message.include?(\"does not exist\")\n  system(\"git submodule update --init --recursive\")\n  retry\nend","preventionTips":["Clone with --recursive or run `git submodule update --init` in CI bootstrap scripts","Double-check path casing when moving projects between case-insensitive (macOS) and case-sensitive (Linux) filesystems","Add a boot check that all :path directories exist before running bundle"],"tags":["bundler","gemfile","path","filesystem","git-submodule"],"backgroundTag":"file-not-found","analyzedSha":"0e5b888e1c355f3f728f2659f085820937dada48","analyzedAt":"2026-08-21T14:25:43.473Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}