ruby/rubygems · error · Gem::OperationNotSupportedError

Not connected to a tty and no default specified

Error message

Not connected to a tty and no default specified

What it means

Error "Not connected to a tty and no default specified" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/user_interaction.rb:249

    result = @ins.gets

    return nil, nil unless result

    result = result.strip.to_i - 1
    return nil, nil unless (0...list.size) === result
    [list[result], result]
  end

  ##
  # Ask a question.  Returns a true for yes, false for no.  If not connected
  # to a tty, raises an exception if default is nil, otherwise returns
  # default.

  def ask_yes_no(question, default = nil)
    unless tty?
      if default.nil?
        raise Gem::OperationNotSupportedError,
              "Not connected to a tty and no default specified"
      else
        return default
      end
    end

    default_answer = case default
                     when nil
                       "yn"
                     when true
                       "Yn"
                     else
                       "yN"
    end

    result = nil

    while result.nil? do

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Run the command interactively (on a TTY) to answer the prompt
  2. Or pass the option/default that avoids the prompt (e.g. --no-interactive flags where available)

When it happens

Trigger: Thrown at lib/rubygems/user_interaction.rb:249 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/7df2c63b37944e13. Report an issue: GitHub.