Repository: floci-io/floci (2026-07-14T14:04:27Z)

Issue:
[BUG] DescribeDBSubnetGroups: empty list instead of DBSubnetGroupNotFoundFault
## Service

RDS

## AWS API Action

DescribeDBSubnetGroups

## AWS Documentation

https://docs.aws.amazon.com/AmazonRDS/latest/APIReference/API_DescribeDBSubnetGroups.html

If `DBSubnetGroupName` does not exist → `DBSubnetGroupNotFoundFault` (HTTP 404).

## Expected behavior

```bash
aws rds describe-db-subnet-groups --db-subnet-group-name does-not-exist
```

→ error `DBSubnetGroupNotFoundFault`.

## Actual behavior

Floci returns HTTP 200:

```json
{
  "DBSubnetGroups": []
}
```

## Reproduction

```bash
export AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test AWS_DEFAULT_REGION=us-east-1
export AWS_ENDPOINT_URL=http://localhost:4566

aws rds describe-db-subnet-groups \
  --db-subnet-group-name does-not-exist \
  --output json
```

## Environment

- Floci version / image tag: nightly
- Running: Docker (port 4566)



Discussion:
DescribeDBSubnetGroups returns an empty list for a `DBSubnetGroupName` that doesn't exist, where real AWS raises `DBSubnetGroupNotFoundFault` (404). In `listDbSubnetGroups` (RdsService.java:724), when a specific non-`default` name is passed it does `subnetGroups.get(filterName).ifPresent(groups::add)` and returns whatever it found — so a missing name produces an empty `<DBSubnetGroups>` with HTTP 200 instead of a fault.

The correct behavior already exists in the same file: `resolveDbSubnetGroupView` (RdsService.java:737) throws exactly `DBSubnetGroupNotFoundFault` / 404 for a missing name. And PR #1740 is applying the same fault-on-missing-identifier fix to DescribeDBInstances / DescribeDBClusters — DescribeDBSubnetGroups is the same contract that pass didn't cover.

Proposal: when a specific, non-`default` `DBSubnetGroupName` is requested and absent, throw `DBSubnetGroupNotFoundFault` (reusing the existing fault), while the synthetic `default` group keeps resolving as it does today. Happy to send a PR aligned with #1740's shape plus a describe-missing-subnet-group test.




Patch:
diff --git a/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java b/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java
index fd2c5ea532..eb9f046069 100644
--- a/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java
+++ b/src/main/java/io/github/hectorvent/floci/services/rds/RdsService.java
@@ -803,7 +803,10 @@ public Collection<DbSubnetGroup> listDbSubnetGroups(String filterName, String re
             groups.add(buildDefaultSubnetGroup(effectiveRegion(region)));
         }
         if (filterName != null && !filterName.isBlank()) {
-            subnetGroups.get(filterName).ifPresent(groups::add);
+            if (!"default".equalsIgnoreCase(filterName)) {
+                // Specific name: AWS DescribeDBSubnetGroups faults when absent (not empty 200).
+                groups.add(resolveDbSubnetGroupView(filterName, region));
+            }
             return groups;
         }
         groups.addAll(subnetGroups.scan(k -> true));


Test patch:
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java
index 13b127086b..ec484ba433 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsQueryHandlerTest.java
@@ -770,6 +770,21 @@ void describeDbSubnetGroupsPassesSignedRegionToService() {
         verify(service).listDbSubnetGroups(null, "us-west-2");
     }
 
+    @Test
+    void describeDbSubnetGroups_missingNameReturnsNotFoundFault() {
+        when(service.listDbSubnetGroups("does-not-exist", null))
+                .thenThrow(new AwsException("DBSubnetGroupNotFoundFault",
+                        "DB subnet group does-not-exist not found.", 404));
+
+        MultivaluedMap<String, String> p = params();
+        p.add("DBSubnetGroupName", "does-not-exist");
+
+        Response response = handler.handle("DescribeDBSubnetGroups", p);
+
+        assertEquals(404, response.getStatus());
+        assertTrue(((String) response.getEntity()).contains("DBSubnetGroupNotFoundFault"));
+    }
+
     // ──────────────────────────── Helpers ────────────────────────────
 
     private static MultivaluedMap<String, String> params() {
diff --git a/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java b/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java
index 544202de8a..02df455e56 100644
--- a/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java
+++ b/src/test/java/io/github/hectorvent/floci/services/rds/RdsServiceTest.java
@@ -293,7 +293,25 @@ void dbSubnetGroupRoundTrip() {
         assertEquals(1, rdsService.listDbSubnetGroups("sample-db-subnets").size());
 
         rdsService.deleteDbSubnetGroup("sample-db-subnets");
-        assertTrue(rdsService.listDbSubnetGroups("sample-db-subnets").isEmpty());
+        AwsException missing = assertThrows(AwsException.class,
+                () -> rdsService.listDbSubnetGroups("sample-db-subnets"));
+        assertEquals("DBSubnetGroupNotFoundFault", missing.getErrorCode());
+        assertEquals(404, missing.getHttpStatus());
+    }
+
+    @Test
+    void listDbSubnetGroupsFaultsForMissingName() {
+        AwsException missing = assertThrows(AwsException.class,
+                () -> rdsService.listDbSubnetGroups("does-not-exist"));
+        assertEquals("DBSubnetGroupNotFoundFault", missing.getErrorCode());
+        assertEquals(404, missing.getHttpStatus());
+    }
+
+    @Test
+    void listDbSubnetGroupsStillResolvesSyntheticDefault() {
+        Collection<DbSubnetGroup> groups = rdsService.listDbSubnetGroups("default");
+        assertEquals(1, groups.size());
+        assertEquals("default", groups.iterator().next().getDbSubnetGroupName());
     }
 
     @Test