we-promise/sure · error · Provider::Redbark::Error

truncated

truncated

Error message

list_accounts returned a truncated account list

What it means

Raised by Provider::Redbark#list_accounts when the Redbark server sets the X-Redbark-Truncated response header to true while paginating GET /accounts. It means the server hit its row ceiling and returned only a partial account list. The client fails closed on purpose: the code comment states a partial account list must never reach downstream pruning, because a sync that prunes accounts missing from the response would delete valid accounts.

Source

Thrown at app/models/provider/redbark.rb:42

  class ConfigurationError < Error; end
  class AuthenticationError < Error; end
  class RateLimitError < Error; end
  class ServerError < Error; end

  attr_reader :api_key

  def initialize(api_key:)
    @api_key = api_key
    validate_configuration!
  end

  # Returns all accounts across the user's connections.
  # Response items: { id, connectionId, provider, name, type, institutionName, accountNumber, currency }
  def list_accounts
    results, truncated = paginate("list_accounts", "#{BASE_URL}/accounts", page_size: ACCOUNTS_PAGE_SIZE)

    # A partial account list must never reach downstream pruning
    raise Error.new("list_accounts returned a truncated account list", :truncated) if truncated

    results
  end

  # Returns all connections: { id, provider, category, institutionId, institutionName,
  # institutionLogo, status, lastRefreshedAt, createdAt }
  def list_connections
    with_retries("list_connections") do
      response = self.class.get("#{BASE_URL}/connections", headers: auth_headers)
      handle_response(response)[:data] || []
    end
  end

  # Returns balances for the given account ids.
  # Response items: { accountId, currentBalance, availableBalance, currency }
  def get_balances(account_ids:)
    return [] if account_ids.blank?

View on GitHub (pinned to e69894adb9)

Solutions

  1. Retry the sync later — the ceiling can be a transient server-side state under load
  2. Reduce the number of active connections on the affected Redbark account so the total fits under the row ceiling
  3. Rescue Provider::Redbark::Error with error_type == :truncated and surface a 'sync incomplete' message instead of letting a partial list prune accounts
  4. Contact Redbark support to raise the row ceiling for the API key if the account count is legitimately large

Example fix

# before
accounts = redbark.list_accounts # raises :truncated on partial data

# after
begin
  accounts = redbark.list_accounts
rescue Provider::Redbark::Error => e
  raise if e.error_type != :truncated
  Rails.logger.warn("Redbark account list truncated; skipping prune this run")
  accounts = nil
end
Defensive patterns

Strategy: try-catch

Type guard

def redbark_truncated?(error)
  error.is_a?(Provider::Redbark::Error) && error.error_type == :truncated
end

Try / catch

begin
  accounts = redbark.list_accounts
rescue Provider::Redbark::Error => e
  raise unless e.error_type == :truncated
  # skip account pruning this run; keep existing accounts untouched
  Sentry.capture_message("redbark truncated", level: :warning)
  accounts = nil
end

Prevention

When it happens

Trigger: Calling client.list_accounts for a user whose total accounts across all connections exceed the server-side row ceiling, so paginate() stops early and returns truncated=true at redbark.rb:42.

Common situations: Users with many bank connections imported at once; Redbark lowering its server row ceiling; aggregating heavy multi-institution setups during initial onboarding.

Related errors


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