ruby/rubygems · error · Gem::WebauthnVerificationError

Security device verification failed: #{parsed_response.fetch

Error message

Security device verification failed: #{parsed_response.fetch("message", "Invalid response from server")}

What it means

Error "Security device verification failed: #{parsed_response.fetch("message", "Invalid response from server")}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/gemcutter_utilities/webauthn_poller.rb:59

        thread[:error] = e
      end
    end

    def poll_for_otp(webauthn_url, credentials)
      Gem::Timeout.timeout(TIMEOUT_IN_SECONDS) do
        loop do
          response = webauthn_verification_poll_response(webauthn_url, credentials)
          raise Gem::WebauthnVerificationError, response.message unless response.is_a?(Gem::Net::HTTPSuccess)

          require "json"
          parsed_response = JSON.parse(response.body)
          case parsed_response["status"]
          when "pending"
            sleep 5
          when "success"
            return parsed_response["code"]
          else
            raise Gem::WebauthnVerificationError, parsed_response.fetch("message", "Invalid response from server")
          end
        end
      end
    end

    private

    def webauthn_verification_poll_response(webauthn_url, credentials)
      webauthn_token = %r{(?<=\/)[^\/]+(?=$)}.match(webauthn_url)[0]
      rubygems_api_request(:get, "api/v1/webauthn_verification/#{webauthn_token}/status.json") do |request|
        if credentials.empty?
          request.add_field "Authorization", api_key
        elsif credentials[:identifier] && credentials[:password]
          request.basic_auth credentials[:identifier], credentials[:password]
        else
          raise Gem::WebauthnVerificationError, "Provided missing credentials"
        end
      end

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Touch your security key when prompted and retry the command
  2. Run `gem signin` again to restart WebAuthn verification
  3. Check the server response message for the specific failure reason

When it happens

Trigger: Thrown at lib/rubygems/gemcutter_utilities/webauthn_poller.rb:59 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/81528583f4ce8063. Report an issue: GitHub.