Skip to content

SDK retries 5x on invalid image — should fail immediately #108

@eilon-decart

Description

@eilon-decart

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions