fix(elasticache): return the modeled capacity fault on proxy-port exhaustion (#2423)

Proxy-port exhaustion threw InsufficientReplicationGroupCapacity with HTTP 503.
No such shape exists in the elasticache model, so SDK clients cannot map it to a
typed exception. CreateReplicationGroup declares InsufficientCacheClusterCapacityFault,
whose wire code is InsufficientCacheClusterCapacity at HTTP 400 with senderFault
set, so return that instead.

The exhausted range is a Floci-side limit rather than anything AWS models, so the
response now carries AWS's own capacity wording and the real cause — the configured
proxy-base-port/proxy-max-port range — is logged at WARN.

Note this changes retry semantics: 503 invites a retry, 400 is a sender fault and
should not be retried. That follows the model, and the previous 503 was inviting
retries against a condition that will not clear on its own.
This commit is contained in:
Hector Ventura authored and GitHub committed 2026-08-20 13:16:59 -04:00
1 parent d778a6e393
commit f40d2e34f3
2 files changed
+42 -2

No files matched your search

@@ -326,8 +326,14 @@ public class ElastiCacheService {
return port;
}
}
throw new AwsException("InsufficientReplicationGroupCapacity",
"No available proxy ports in range " + base + "-" + max, 503);
// Proxy-port exhaustion is a Floci-side limit, but on the wire it must look like the
// modeled capacity fault. botocore/smithy declare InsufficientCacheClusterCapacityFault
// for CreateReplicationGroup: awsQueryError code InsufficientCacheClusterCapacity,
// HTTP 400, Sender fault. The old InsufficientReplicationGroupCapacity/503 is invented —
// no such shape exists, so SDK clients cannot map it. Keep the real cause in the log.
LOG.warnv("ElastiCache proxy port range {0}-{1} exhausted; returning InsufficientCacheClusterCapacity", base, max);
throw new AwsException("InsufficientCacheClusterCapacity",
"The requested cache node type is not available in the specified Availability Zone.", 400);
}
private void releaseProxyPort(int port) {