diff --git a/tests/Feature/OpenBanking/InteractiveBrokersControllerTest.php b/tests/Feature/OpenBanking/InteractiveBrokersControllerTest.php
index e780e7a0..eda548a8 100644
--- a/tests/Feature/OpenBanking/InteractiveBrokersControllerTest.php
+++ b/tests/Feature/OpenBanking/InteractiveBrokersControllerTest.php
@@ -6,6 +6,7 @@ use App\Models\Bank;
use App\Models\BankingConnection;
use App\Models\User;
use Illuminate\Support\Facades\Http;
+use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Queue;
use Illuminate\Support\Sleep;
@@ -164,3 +165,24 @@ test('reports a rate-limit message when IB throttles the request', function () {
->assertUnprocessable()
->assertJsonFragment(['message' => 'Interactive Brokers is rate limiting requests. Please wait a few minutes and try again.']);
});
+
+test('a valid but empty flex statement returns 422 without creating a connection or logging a warning', function () {
+ Log::spy();
+
+ $user = User::factory()->onboarded()->create();
+ Http::fake([
+ '*SendRequest*' => Http::response('Success999'),
+ '*GetStatement*' => Http::response(''),
+ ]);
+
+ $this->actingAs($user)->postJson('/open-banking/interactive-brokers/connect', ibConnect())
+ ->assertUnprocessable()
+ ->assertJsonFragment(['message' => 'No accounts found in the Flex statement. Check that your Flex Query includes the NAV section.']);
+
+ $this->assertDatabaseMissing('banking_connections', [
+ 'user_id' => $user->id,
+ 'provider' => 'interactivebrokers',
+ ]);
+
+ Log::shouldNotHaveReceived('warning');
+});