{"record":{"id":"a057f3668c74f071","repo":"we-promise/sure","slug":"parsed-information","errorCode":null,"errorMessage":"parsed[\"Information\"]","messagePattern":"parsed\\[\"Information\"\\]","errorType":"exception","errorClass":"Provider::AlphaVantage::RateLimitError","httpStatus":null,"severity":"warning","filePath":"app/models/provider/alpha_vantage.rb","lineNumber":332,"sourceCode":"      Rails.cache.write(cache_key, currency, expires_in: 24.hours)\n      currency\n    end\n\n    # Checks for Alpha Vantage-specific error responses.\n    # Alpha Vantage returns errors as JSON keys rather than HTTP status codes.\n    def check_api_error!(parsed)\n      return unless parsed.is_a?(Hash)\n\n      # Rate limit: Alpha Vantage returns a \"Note\" key when rate-limited\n      if parsed[\"Note\"].present?\n        Rails.logger.warn(\"AlphaVantage rate limit: #{parsed[\"Note\"]}\")\n        raise RateLimitError, parsed[\"Note\"]\n      end\n\n      # General info/limit messages\n      if parsed[\"Information\"].present?\n        Rails.logger.warn(\"AlphaVantage info: #{parsed[\"Information\"]}\")\n        raise RateLimitError, parsed[\"Information\"]\n      end\n\n      # Explicit error messages for invalid parameters\n      if parsed[\"Error Message\"].present?\n        raise Error, \"API error: #{parsed[\"Error Message\"]}\"\n      end\n    end\nend\n","sourceCodeStart":314,"sourceCodeEnd":341,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/app/models/provider/alpha_vantage.rb#L314-L341","documentation":"Provider::AlphaVantage#check_api_error! scans the parsed JSON body after every API call. When Alpha Vantage returns a top-level \"Information\" key, the provider logs it and raises Provider::AlphaVantage::RateLimitError. Alpha Vantage uses the \"Information\" key for quota and access notices (most famously the free-tier limit of 25 requests per day, or messages telling you to upgrade to a premium key), so the library maps it to a rate-limit condition.","triggerScenarios":"Any Alpha Vantage sync/exchange-rate call whose response body is a Hash containing a present \"Information\" key: the 26th request in a day on a free API key, calling a premium-only endpoint (e.g. some FOREX/crypto or real-time functions) with a free key, or hitting an upgraded key's per-minute quota. check_api_error! runs after JSON parsing, before any data is returned.","commonSituations":"Free-tier key exhausted for the day; using the app's shared/default key while many users sync simultaneously; Alpha Vantage rotating between \"Note\" and \"Information\" wording for quota messages; environment (prod) using a demo key copied from docs.","solutions":["Wait for the daily quota reset (free tier resets at UTC midnight) or upgrade to a premium Alpha Vantage key and set it under Settings > Data Providers so you are not on a shared key.","If the message mentions a specific endpoint being premium, switch to a function available on your tier or use a different securities provider for that symbol.","Rescue Provider::AlphaVantage::RateLimitError in the sync job and back off / reschedule instead of failing the whole sync.","Re-run the same request with curl to confirm whether the message is quota or endpoint related."],"exampleFix":"# before\nparsed = fetch_json(path)\nresult = parse_series(parsed) # blows up later with confusing nil errors\n\n# after\nbegin\n  parsed = provider.fetch_series(symbol)\nrescue Provider::AlphaVantage::RateLimitError => e\n  Rails.logger.warn(\"Alpha Vantage quota hit: #{e.message}\")\n  retry_later(interval: 1.hour) # or mark sync as rate-limited and stop\nend","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  provider.sync(symbol)\nrescue Provider::AlphaVantage::RateLimitError => e\n  Rails.logger.warn(\"Alpha Vantage quota: #{e.message}\")\n  reschedule_sync(in: quota_reset_interval) # back off; do not hot-retry\nend","preventionTips":["Set your own Alpha Vantage API key in Settings > Data Providers instead of relying on shared keys.","Cache quotes/exchange rates so repeat syncs don't burn the 25/day free quota.","Schedule syncs with spacing (or jittered cron) to stay under per-minute/day limits."],"tags":["alpha-vantage","rate-limit","api-quota","securities","stock-prices"],"backgroundTag":"api-rate-limit","analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}