{"record":{"id":"92769a9fa45b7150","repo":"we-promise/sure","slug":"truncated","errorCode":"truncated","errorMessage":"list_accounts returned a truncated account list","messagePattern":"list_accounts returned a truncated account list","errorType":"exception","errorClass":"Provider::Redbark::Error","httpStatus":null,"severity":"error","filePath":"app/models/provider/redbark.rb","lineNumber":42,"sourceCode":"  class ConfigurationError < Error; end\n  class AuthenticationError < Error; end\n  class RateLimitError < Error; end\n  class ServerError < Error; end\n\n  attr_reader :api_key\n\n  def initialize(api_key:)\n    @api_key = api_key\n    validate_configuration!\n  end\n\n  # Returns all accounts across the user's connections.\n  # Response items: { id, connectionId, provider, name, type, institutionName, accountNumber, currency }\n  def list_accounts\n    results, truncated = paginate(\"list_accounts\", \"#{BASE_URL}/accounts\", page_size: ACCOUNTS_PAGE_SIZE)\n\n    # A partial account list must never reach downstream pruning\n    raise Error.new(\"list_accounts returned a truncated account list\", :truncated) if truncated\n\n    results\n  end\n\n  # Returns all connections: { id, provider, category, institutionId, institutionName,\n  # institutionLogo, status, lastRefreshedAt, createdAt }\n  def list_connections\n    with_retries(\"list_connections\") do\n      response = self.class.get(\"#{BASE_URL}/connections\", headers: auth_headers)\n      handle_response(response)[:data] || []\n    end\n  end\n\n  # Returns balances for the given account ids.\n  # Response items: { accountId, currentBalance, availableBalance, currency }\n  def get_balances(account_ids:)\n    return [] if account_ids.blank?\n","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/app/models/provider/redbark.rb#L24-L60","documentation":"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.","triggerScenarios":"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.","commonSituations":"Users with many bank connections imported at once; Redbark lowering its server row ceiling; aggregating heavy multi-institution setups during initial onboarding.","solutions":["Retry the sync later — the ceiling can be a transient server-side state under load","Reduce the number of active connections on the affected Redbark account so the total fits under the row ceiling","Rescue Provider::Redbark::Error with error_type == :truncated and surface a 'sync incomplete' message instead of letting a partial list prune accounts","Contact Redbark support to raise the row ceiling for the API key if the account count is legitimately large"],"exampleFix":"# before\naccounts = redbark.list_accounts # raises :truncated on partial data\n\n# after\nbegin\n  accounts = redbark.list_accounts\nrescue Provider::Redbark::Error => e\n  raise if e.error_type != :truncated\n  Rails.logger.warn(\"Redbark account list truncated; skipping prune this run\")\n  accounts = nil\nend","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"def redbark_truncated?(error)\n  error.is_a?(Provider::Redbark::Error) && error.error_type == :truncated\nend","tryCatchPattern":"begin\n  accounts = redbark.list_accounts\nrescue Provider::Redbark::Error => e\n  raise unless e.error_type == :truncated\n  # skip account pruning this run; keep existing accounts untouched\n  Sentry.capture_message(\"redbark truncated\", level: :warning)\n  accounts = nil\nend","preventionTips":["Never run destructive pruning off a Redbark account fetch without first confirming it was not truncated","Alert on repeated :truncated occurrences so ceiling problems surface early","Track per-user connection counts so heavy users are identified before they hit the ceiling"],"tags":["redbark","pagination","truncation","accounts","row-ceiling"],"backgroundTag":"paginated-api-truncated-response","analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}