{"record":{"id":"f2a863ecf842ccb1","repo":"we-promise/sure","slug":"failed-to-obtain-yahoo-finance-cookie","errorCode":null,"errorMessage":"Failed to obtain Yahoo Finance cookie","messagePattern":"Failed to obtain Yahoo Finance cookie","errorType":"exception","errorClass":"Provider::YahooFinance::AuthenticationError","httpStatus":null,"severity":"error","filePath":"app/models/provider/yahoo_finance.rb","lineNumber":898,"sourceCode":"        \"Yahoo Finance rate limit exceeded\",\n        details: { status: e.response&.dig(:status) }\n      )\n    rescue Faraday::Error => e\n      raise AuthenticationError, \"Failed to authenticate with Yahoo Finance: #{e.message}\"\n    end\n\n    def request_cookie_and_crumb(authentication_client)\n      cookie_response = authentication_client.get(\"https://fc.yahoo.com\")\n      if cookie_response.respond_to?(:status) && cookie_response.status == 429\n        raise RateLimitError.new(\n          \"Yahoo Finance rate limit exceeded\",\n          details: { status: cookie_response.status }\n        )\n      end\n\n      cookie = extract_cookie(cookie_response)\n      cookie_max_age = extract_cookie_max_age(cookie_response)\n      raise AuthenticationError, \"Failed to obtain Yahoo Finance cookie\" if cookie.blank?\n\n      crumb_response = authentication_client.get(\"#{base_url}/v1/test/getcrumb\") do |req|\n        req.headers[\"Cookie\"] = cookie\n      end\n      if crumb_response.status == 429\n        raise RateLimitError.new(\n          \"Yahoo Finance rate limit exceeded\",\n          details: { status: crumb_response.status }\n        )\n      end\n      unless crumb_response.success?\n        raise AuthenticationError.new(\n          \"Failed to obtain Yahoo Finance crumb\",\n          details: { status: crumb_response.status }\n        )\n      end\n\n      crumb = crumb_response.body.to_s.strip","sourceCodeStart":880,"sourceCodeEnd":916,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/app/models/provider/yahoo_finance.rb#L880-L916","documentation":"Error \"Failed to obtain Yahoo Finance cookie\" thrown in we-promise/sure.","triggerScenarios":"Thrown at app/models/provider/yahoo_finance.rb:898 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}