{"record":{"id":"81528583f4ce8063","repo":"ruby/rubygems","slug":"security-device-verification-failed-parsed-resp","errorCode":null,"errorMessage":"Security device verification failed: #{parsed_response.fetch(\"message\", \"Invalid response from server\")}","messagePattern":"Security device verification failed: #(.+?)","errorType":"exception","errorClass":"Gem::WebauthnVerificationError","httpStatus":null,"severity":"error","filePath":"lib/rubygems/gemcutter_utilities/webauthn_poller.rb","lineNumber":59,"sourceCode":"        thread[:error] = e\n      end\n    end\n\n    def poll_for_otp(webauthn_url, credentials)\n      Gem::Timeout.timeout(TIMEOUT_IN_SECONDS) do\n        loop do\n          response = webauthn_verification_poll_response(webauthn_url, credentials)\n          raise Gem::WebauthnVerificationError, response.message unless response.is_a?(Gem::Net::HTTPSuccess)\n\n          require \"json\"\n          parsed_response = JSON.parse(response.body)\n          case parsed_response[\"status\"]\n          when \"pending\"\n            sleep 5\n          when \"success\"\n            return parsed_response[\"code\"]\n          else\n            raise Gem::WebauthnVerificationError, parsed_response.fetch(\"message\", \"Invalid response from server\")\n          end\n        end\n      end\n    end\n\n    private\n\n    def webauthn_verification_poll_response(webauthn_url, credentials)\n      webauthn_token = %r{(?<=\\/)[^\\/]+(?=$)}.match(webauthn_url)[0]\n      rubygems_api_request(:get, \"api/v1/webauthn_verification/#{webauthn_token}/status.json\") do |request|\n        if credentials.empty?\n          request.add_field \"Authorization\", api_key\n        elsif credentials[:identifier] && credentials[:password]\n          request.basic_auth credentials[:identifier], credentials[:password]\n        else\n          raise Gem::WebauthnVerificationError, \"Provided missing credentials\"\n        end\n      end","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/ruby/rubygems/blob/86cbb817a38ce8477b181c17467a703ded3f2be8/lib/rubygems/gemcutter_utilities/webauthn_poller.rb#L41-L77","documentation":"Error \"Security device verification failed: #{parsed_response.fetch(\"message\", \"Invalid response from server\")}\" thrown in ruby/rubygems.","triggerScenarios":"Thrown at lib/rubygems/gemcutter_utilities/webauthn_poller.rb:59 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Touch your security key when prompted and retry the command","Run `gem signin` again to restart WebAuthn verification","Check the server response message for the specific failure reason"],"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"}