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

server_error

server_error

Error message

Redbark server error (#{response.code})

What it means

Raised by Provider::Redbark's handle_response on any 5xx status as ServerError, carrying the status code in the message. ServerError is in with_retries' retryable list, so transient 5xx responses are retried with exponential backoff; this error means 5xx persisted through all retries.

Source

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

    # response body - callers log and re-log these strings.
    def handle_response(response)
      case response.code
      when 200, 201
        JSON.parse(response.body, symbolize_names: true)
      when 400
        raise Error.new("Bad request: #{error_message_from(response)}", :bad_request)
      when 401
        raise AuthenticationError.new("Invalid API key", :unauthorized)
      when 403
        raise AuthenticationError.new("Access forbidden - your Redbark plan may not include API access", :access_forbidden)
      when 404
        raise Error.new("Resource not found", :not_found)
      when 410
        raise Error.new("Endpoint requires an accountId: #{error_message_from(response)}", :bad_request)
      when 429
        raise RateLimitError.new("Rate limit exceeded", :rate_limited)
      when 500..599
        raise ServerError.new("Redbark server error (#{response.code})", :server_error)
      else
        raise Error.new("Unexpected response #{response.code}: #{error_message_from(response)}", :unknown)
      end
    end

    def error_message_from(response)
      parsed = JSON.parse(response.body)
      parsed.dig("error", "message") || "no error message provided"
    rescue JSON::ParserError
      "unparseable error response"
    end
end

View on GitHub (pinned to e69894adb9)

Solutions

  1. Check Redbark status page / support channels for an incident
  2. Retry the sync later from the caller with a longer outer backoff (the internal retries are done)
  3. If only one endpoint fails, scope the incident report to that path with timestamps from logs
  4. Keep the failed run idempotent so the retry picks up cleanly
Defensive patterns

Strategy: retry

Type guard

def redbark_server_error?(error)
  error.is_a?(Provider::Redbark::ServerError)
end

Try / catch

begin
  redbark.list_accounts
rescue Provider::Redbark::ServerError => e
  Rails.logger.warn("Redbark 5xx persisted: #{e.message}")
  RedbarkSyncJob.perform_in(1.hour, user.id) # idempotent retry after outage window
end

Prevention

When it happens

Trigger: Redbark returning 500-599 on any endpoint (accounts, connections, balances, transactions) across 3+ consecutive attempts over roughly 14+ seconds of backoff.

Common situations: Redbark outage or degraded period; a specific endpoint broken by a bad deploy while others work; overloaded API during month-end sync peaks.

Related errors


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