{"record":{"id":"35db7ddb832e31df","repo":"we-promise/sure","slug":"server-error-35db7d","errorCode":"server_error","errorMessage":"Redbark server error (#{response.code})","messagePattern":"Redbark server error \\(#(.+?)\\)","errorType":"exception","errorClass":"Provider::Redbark::ServerError","httpStatus":null,"severity":"error","filePath":"app/models/provider/redbark.rb","lineNumber":250,"sourceCode":"    # response body - callers log and re-log these strings.\n    def handle_response(response)\n      case response.code\n      when 200, 201\n        JSON.parse(response.body, symbolize_names: true)\n      when 400\n        raise Error.new(\"Bad request: #{error_message_from(response)}\", :bad_request)\n      when 401\n        raise AuthenticationError.new(\"Invalid API key\", :unauthorized)\n      when 403\n        raise AuthenticationError.new(\"Access forbidden - your Redbark plan may not include API access\", :access_forbidden)\n      when 404\n        raise Error.new(\"Resource not found\", :not_found)\n      when 410\n        raise Error.new(\"Endpoint requires an accountId: #{error_message_from(response)}\", :bad_request)\n      when 429\n        raise RateLimitError.new(\"Rate limit exceeded\", :rate_limited)\n      when 500..599\n        raise ServerError.new(\"Redbark server error (#{response.code})\", :server_error)\n      else\n        raise Error.new(\"Unexpected response #{response.code}: #{error_message_from(response)}\", :unknown)\n      end\n    end\n\n    def error_message_from(response)\n      parsed = JSON.parse(response.body)\n      parsed.dig(\"error\", \"message\") || \"no error message provided\"\n    rescue JSON::ParserError\n      \"unparseable error response\"\n    end\nend\n","sourceCodeStart":232,"sourceCodeEnd":263,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/app/models/provider/redbark.rb#L232-L263","documentation":"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.","triggerScenarios":"Redbark returning 500-599 on any endpoint (accounts, connections, balances, transactions) across 3+ consecutive attempts over roughly 14+ seconds of backoff.","commonSituations":"Redbark outage or degraded period; a specific endpoint broken by a bad deploy while others work; overloaded API during month-end sync peaks.","solutions":["Check Redbark status page / support channels for an incident","Retry the sync later from the caller with a longer outer backoff (the internal retries are done)","If only one endpoint fails, scope the incident report to that path with timestamps from logs","Keep the failed run idempotent so the retry picks up cleanly"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":"def redbark_server_error?(error)\n  error.is_a?(Provider::Redbark::ServerError)\nend","tryCatchPattern":"begin\n  redbark.list_accounts\nrescue Provider::Redbark::ServerError => e\n  Rails.logger.warn(\"Redbark 5xx persisted: #{e.message}\")\n  RedbarkSyncJob.perform_in(1.hour, user.id) # idempotent retry after outage window\nend","preventionTips":["Make sync jobs idempotent so hour-scale retries are safe","Subscribe to Redbark status notifications and pause syncs during incidents","Track 5xx rates per endpoint to spot partial degradations early"],"tags":["redbark","http-5xx","server-error","upstream-outage","retry"],"backgroundTag":"http-5xx-server-error","analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}