isTransientTransportError function
Whether message is a transient transport failure the chain may retry
in place: the endpoint (or the network path to it) dropped, so rotating
credentials is pointless — the same entry is retried with backoff, then
the chain fails over to the next model. Context overflow and rate limits
are excluded (their own policies own them).
Implementation
bool isTransientTransportError(AssistantMessage message) {
if (message.stopReason != StopReason.error) return false;
final text = message.errorMessage;
if (text == null || text.isEmpty) return false;
if (isContextOverflow(message)) return false;
if (_rateLimitPatterns.any((pattern) => pattern.hasMatch(text))) {
return false;
}
return _transportPatterns.any((pattern) => pattern.hasMatch(text));
}