Conversation
RTCEngine has three `this.negotiate()` call sites; two attach `.catch((err) => this.log.error(err))` and the one wired to `client.onMediaSectionsRequirement` does not. A renegotiation that fails there rejects into nothing, so instead of a logged error the application sees an unhandled promise rejection with no stack — on React Native it reaches crash reporting as a bare `onunhandledrejection`, detached from the disconnect it accompanies. Nothing changes behaviourally: `negotiate()` already calls `handleDisconnect` before rejecting, so the engine's own recovery runs either way. This only routes the error to the logger the other two call sites use.
SergeAx
requested review from
1egoman,
lukasIO and
xianshijing-lk
as code owners
September 18, 2026 09:18
🦋 Changeset detectedLatest commit: 8ff8dc9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Author
|
This patch is written by an agent (Claude Code @ Opus 5.1 xhigh) and verified by me, a human. Claude's vanity trailer in the commit message is omitted per my local settings. |
1egoman
approved these changes
Sep 18, 2026
1egoman
left a comment
Contributor
There was a problem hiding this comment.
Makes sense to me, thanks for the contribution!
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RTCEnginehas threethis.negotiate()call sites. Two of them attach the same handler:The third — the one wired to
client.onMediaSectionsRequirement— does not:https://github.com/livekit/client-sdk-js/blob/main/src/room/RTCEngine.ts#L756-L759
So when a renegotiation triggered by the server's media-sections requirement fails, the rejection goes nowhere. Instead of a logged error the application gets an unhandled promise rejection, and because
negotiate()rejects from a detached promise there is no stack and no context attached to it.We hit this on React Native (
livekit-client2.20.0). It reaches Sentry as a bareonunhandledrejection— in our caseError: Session error code: ERROR_CONTENT. Session error description: Failed to apply the description for m= section with mid='0': Local fingerprint does not match identity…— grouped as its own issue, disconnected from theNegotiationErrorthat the same failure also produces through the caught paths. That made it look like two unrelated faults during triage.This does not change behaviour:
negotiate()already callshandleDisconnect('negotiation', ReconnectReason.RR_UNKNOWN)before it rejects, so the engine's own recovery runs either way. The patch only routes the error into the logger the other two call sites already use.Still present on
mainand in 2.22.3.Checks
npx tsc --noEmit— cleannpx vitest run src/room— 593 passednpx prettier --check— clean