-
Notifications
You must be signed in to change notification settings - Fork 2
SDK retries 5x on invalid image — should fail immediately #108
Description
Problem
When the user provides an invalid/corrupt image during connect() (via initialImage), the bouncer rejects it with a set_image_ack with success: false and an error like "Could not decode image: image/png file appears corrupt or truncated (1234 bytes)".
The SDK correctly rejects the promise, but connect() is wrapped in pRetry with shouldRetry that only checks against PERMANENT_ERRORS (blocklist: "permission denied", "invalid api key", etc.).
Since image errors dont match any permanent error, the SDK retries the same bad image 5 times with exponential backoff (~30s total), producing 5 identical error logs on the bouncer.
Impact
- Users wait ~30s for an error that should be instant
- Bouncer gets 5x the error volume for each bad image
- Currently the initial draft #1 remaining error pattern in bouncer-realtime logs (~18 errors/30min, many are retries of the same image)
Fix
Add image validation errors to PERMANENT_ERRORS in webrtc-manager.ts:
const PERMANENT_ERRORS = [
// existing...
"could not decode image",
"invalid image",
"expected an image",
"image too large",
];Or more robustly: treat any set_image_ack with success: false during Phase 2 as non-retryable (same image = same error every time).
Related
- Bouncer PR DecartAI/api#919 — adds detailed image error messages
- SDK issue SDK should only retry on known-retryable bouncer errors during initial connect #107 — broader retry logic improvements