we-promise/sure · error · Provider::Simplefin::SimplefinError

server_error

server_error

Error message

SimpleFin server error (#{response.code}). Please try again later.

What it means

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.

Source

Thrown at app/models/provider/simplefin.rb:100

      self.class.get(accounts_url)
    end

    case response.code
    when 200
      JSON.parse(response.body, symbolize_names: true)
    when 400
      Rails.logger.error "SimpleFin API: Bad request - #{response.body}"
      raise SimplefinError.new("Bad request to SimpleFin API: #{response.body}", :bad_request)
    when 403
      raise SimplefinError.new("Access URL is no longer valid", :access_forbidden)
    when 402
      raise SimplefinError.new("Payment required to access this account", :payment_required)
    when 429
      Rails.logger.warn "SimpleFin API: Rate limited - #{response.body}"
      raise SimplefinError.new("SimpleFin rate limit exceeded. Please try again later.", :rate_limited)
    when 500..599
      Rails.logger.error "SimpleFin API: Server error - Code: #{response.code}, Body: #{response.body}"
      raise SimplefinError.new("SimpleFin server error (#{response.code}). Please try again later.", :server_error)
    else
      Rails.logger.error "SimpleFin API: Unexpected response - Code: #{response.code}, Body: #{response.body}"
      raise SimplefinError.new("Failed to fetch accounts: #{response.code} #{response.message} - #{response.body}", :fetch_failed)
    end
  end

  def get_info(base_url)
    # Use self.class.get to inherit class-level SSL and timeout defaults
    response = self.class.get("#{base_url}/info")

    case response.code
    when 200
      response.body.strip.split("\n")
    else
      raise SimplefinError.new("Failed to get server info: #{response.code} #{response.message}", :info_failed)
    end
  end

View on GitHub (pinned to e69894adb9)

Solutions

  1. 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
  2. Check the preceding Rails log line 'SimpleFin API: Server error - Code: ... Body: ...' for the exact status and any upstream message
  3. Test the same access URL with curl to see if the 5xx reproduces outside the app
  4. If one user's account consistently 500s while others work, the bank adapter is broken on SimpleFIN's side - wait or contact SimpleFIN support

Example fix

# before
accounts = simplefin.get_accounts

# after - caller retries transient 5xx with backoff
begin
  accounts = simplefin.get_accounts
rescue Provider::Simplefin::SimplefinError => e
  retry_after_backoff if e.error_type == :server_error # transient upstream failure
  raise
end
Defensive patterns

Strategy: retry

Try / catch

begin
  result = simplefin.get_accounts
rescue Provider::Simplefin::SimplefinError => e
  if e.error_type == :server_error
    schedule_retry(minutes: 15) # transient upstream 5xx, keep prior data
  else
    raise
  end
end

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of we-promise/sure@e69894adb9 (2026-08-21). Data as JSON: /api/errors/df872c117001a4b6. Report an issue: GitHub.