{"record":{"id":"f01c6d0b67090792","repo":"ruby/rubygems","slug":"spec-has-an-invalid-bindir","errorCode":null,"errorMessage":"#{spec} has an invalid bindir","messagePattern":"#(.+?) has an invalid bindir","errorType":"exception","errorClass":"Gem::InstallError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/installer.rb","lineNumber":720,"sourceCode":"    end\n\n    unless /\\A\\d+\\z/.match?(spec.specification_version.to_s)\n      raise Gem::InstallError, \"#{spec} has an invalid specification_version\"\n    end\n\n    if spec.dependencies.any? {|dep| dep.type != :runtime && dep.type != :development }\n      raise Gem::InstallError, \"#{spec} has an invalid dependencies\"\n    end\n\n    if spec.dependencies.any? {|dep| dep.name =~ /(?:\\R|[<>])/ }\n      raise Gem::InstallError, \"#{spec} has an invalid dependencies\"\n    end\n\n    if spec.executables.any? {|name| !name.is_a?(String) || name != File.basename(name) || /\\A\\.\\.?\\z|\\R/.match?(name) }\n      raise Gem::InstallError, \"#{spec} has an invalid executable\"\n    end\n\n    raise Gem::InstallError, \"#{spec} has an invalid bindir\" unless spec.bindir.is_a?(String)\n\n    expanded_gem_dir = File.expand_path(gem_dir)\n    expanded_bindir = File.expand_path(File.join(gem_dir, spec.bindir))\n    unless expanded_bindir == expanded_gem_dir || expanded_bindir.start_with?(\"#{expanded_gem_dir}/\")\n      raise Gem::InstallError, \"#{spec} has an invalid bindir\"\n    end\n  end\n\n  ##\n  # Return the text for an application file.\n\n  def app_script_text(bin_file_name)\n    # NOTE: that the `load` lines cannot be indented, as old RG versions match\n    # against the beginning of the line\n    escaped_bin_file_name = bin_file_name.gsub(/[\\\\']/) {|c| \"\\\\#{c}\" }\n    <<~TEXT\n      #{shebang bin_file_name}\n      #","sourceCodeStart":702,"sourceCodeEnd":738,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/installer.rb#L702-L738","documentation":"Error \"#{spec} has an invalid bindir\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/installer.rb:720 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set `spec.bindir` to an existing directory containing the executables (default: 'bin')"],"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"}