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

not_found

not_found

Error message

Resource not found

What it means

Raised by Provider::Redbark's handle_response on HTTP 404 with error_type :not_found. The requested resource (endpoint path or referenced entity) does not exist on Redbark's side.

Source

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

        "Accept" => "application/json"
      }
    end

    # Redbark error envelope: { error: { message, code, details } }
    # Error messages carry the parsed provider message only, never the raw
    # 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. Refresh the id list via list_accounts/list_connections and drop ids that no longer exist
  2. Verify the id values being passed match the response shapes ({ id } for accounts, { id } for connections)
  3. If every call 404s including /accounts, check the Redbark changelog for a versioned endpoint change
  4. Treat per-entity 404s during sync as 'disconnected upstream' and deactivate that entity locally
Defensive patterns

Strategy: validation

Validate before calling

def redbark_account_active?(redbark, connection_id, account_id)
  redbark.list_accounts.any? { |a| a[:id] == account_id && a[:connectionId] == connection_id }
end

Type guard

def redbark_not_found?(error)
  error.is_a?(Provider::Redbark::Error) && error.error_type == :not_found
end

Try / catch

begin
  redbark.get_balances(account_ids: [aid])
rescue Provider::Redbark::Error => e
  raise unless e.error_type == :not_found
  deactivate_account_locally(aid) # disconnected upstream at Redbark
end

Prevention

When it happens

Trigger: get_transactions or get_balances called with an accountId/connectionId that was deleted or disconnected at Redbark; requesting an endpoint removed from the API version at BASE_URL (https://api.redbark.com/v1).

Common situations: User disconnects a bank at Redbark while your sync still holds its cached ids; stale account ids persisted from an old connection; Redbark API version bump removing an endpoint.

Related errors


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