{"record":{"id":"df872c117001a4b6","repo":"we-promise/sure","slug":"server-error-df872c","errorCode":"server_error","errorMessage":"SimpleFin server error (#{response.code}). Please try again later.","messagePattern":"SimpleFin server error \\(#(.+?)\\)\\. Please try again later\\.","errorType":"exception","errorClass":"Provider::Simplefin::SimplefinError","httpStatus":null,"severity":"error","filePath":"app/models/provider/simplefin.rb","lineNumber":100,"sourceCode":"      self.class.get(accounts_url)\n    end\n\n    case response.code\n    when 200\n      JSON.parse(response.body, symbolize_names: true)\n    when 400\n      Rails.logger.error \"SimpleFin API: Bad request - #{response.body}\"\n      raise SimplefinError.new(\"Bad request to SimpleFin API: #{response.body}\", :bad_request)\n    when 403\n      raise SimplefinError.new(\"Access URL is no longer valid\", :access_forbidden)\n    when 402\n      raise SimplefinError.new(\"Payment required to access this account\", :payment_required)\n    when 429\n      Rails.logger.warn \"SimpleFin API: Rate limited - #{response.body}\"\n      raise SimplefinError.new(\"SimpleFin rate limit exceeded. Please try again later.\", :rate_limited)\n    when 500..599\n      Rails.logger.error \"SimpleFin API: Server error - Code: #{response.code}, Body: #{response.body}\"\n      raise SimplefinError.new(\"SimpleFin server error (#{response.code}). Please try again later.\", :server_error)\n    else\n      Rails.logger.error \"SimpleFin API: Unexpected response - Code: #{response.code}, Body: #{response.body}\"\n      raise SimplefinError.new(\"Failed to fetch accounts: #{response.code} #{response.message} - #{response.body}\", :fetch_failed)\n    end\n  end\n\n  def get_info(base_url)\n    # Use self.class.get to inherit class-level SSL and timeout defaults\n    response = self.class.get(\"#{base_url}/info\")\n\n    case response.code\n    when 200\n      response.body.strip.split(\"\\n\")\n    else\n      raise SimplefinError.new(\"Failed to get server info: #{response.code} #{response.message}\", :info_failed)\n    end\n  end\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/app/models/provider/simplefin.rb#L82-L118","documentation":"Raised by Provider::Simplefin's response handler when the SimpleFIN broker-adapter API returns any HTTP 5xx status while fetching accounts/transactions. The 5xx means the failure is on SimpleFIN's side (overloaded adapter, upstream bank outage, internal error), not in this app. The full response code and body are logged to the Rails logger before the SimplefinError(:server_error) is raised.","triggerScenarios":"A GET to the user's SimpleFIN access URL returns 500, 502, 503, or 504 - typically during a sync job (autosync or manual 'refresh') when the target bank adapter inside SimpleFIN is failing. Distinct from network errors: the TCP/HTTP round trip succeeded; the server answered with 5xx.","commonSituations":"A specific bank's SimpleFIN adapter is down while others work; SimpleFIN itself has an incident; retrying later succeeds; happens intermittently during nightly autosync windows when many users sync at once.","solutions":["Retry the sync after a delay (minutes to hours) - most SimpleFIN 5xx are transient; note the library's with_retries only retries network exceptions, so HTTP 5xx must be retried by the caller","Check the preceding Rails log line 'SimpleFin API: Server error - Code: ... Body: ...' for the exact status and any upstream message","Test the same access URL with curl to see if the 5xx reproduces outside the app","If one user's account consistently 500s while others work, the bank adapter is broken on SimpleFIN's side - wait or contact SimpleFIN support"],"exampleFix":"# before\naccounts = simplefin.get_accounts\n\n# after - caller retries transient 5xx with backoff\nbegin\n  accounts = simplefin.get_accounts\nrescue Provider::Simplefin::SimplefinError => e\n  retry_after_backoff if e.error_type == :server_error # transient upstream failure\n  raise\nend","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"begin\n  result = simplefin.get_accounts\nrescue Provider::Simplefin::SimplefinError => e\n  if e.error_type == :server_error\n    schedule_retry(minutes: 15) # transient upstream 5xx, keep prior data\n  else\n    raise\n  end\nend","preventionTips":["Branch on e.error_type rather than parsing the message string","Treat 5xx as 'keep last good snapshot + retry later', never as empty data","Alert only on repeated server_error within a window, not single occurrences"],"tags":["simplefin","http-5xx","upstream","bank-sync","provider-api"],"backgroundTag":"http-5xx-server-error","analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}