{"record":{"id":"039323565fe254e4","repo":"ruby/rubygems","slug":"spec-has-an-invalid-executable","errorCode":null,"errorMessage":"#{spec} has an invalid executable","messagePattern":"#(.+?) has an invalid executable","errorType":"exception","errorClass":"Gem::InstallError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/installer.rb","lineNumber":717,"sourceCode":"\n    unless /\\A[\\w.-]+\\z/.match?(spec.platform.to_s)\n      raise Gem::InstallError, \"#{spec.platform} is an invalid platform\"\n    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}\" }","sourceCodeStart":699,"sourceCodeEnd":735,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/installer.rb#L699-L735","documentation":"Error \"#{spec} has an invalid executable\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/installer.rb:717 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix `spec.executables` to name files that exist in the bindir"],"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"}