Update Simli integation endpoint#4894
Conversation
livekit-plugins/livekit-plugins-simli/livekit/plugins/simli/avatar.py
Outdated
Show resolved
Hide resolved
livekit-plugins/livekit-plugins-simli/livekit/plugins/simli/avatar.py
Outdated
Show resolved
Hide resolved
| except Exception: | ||
| logger.error( | ||
| f"failed to connect to simli avatar session server returned {avatarConnectionRequest.status} and detail {body}" |
There was a problem hiding this comment.
🔴 UnboundLocalError in second except block when HTTP POST itself fails
Same issue as the first except block: if the post() call on line 130 raises an exception, avatarConnectionRequest is never assigned. The except handler on line 141-142 references avatarConnectionRequest.status, which will raise UnboundLocalError. Similarly, if line 130 succeeds but line 138 (body = await avatarConnectionRequest.text()) fails, body still holds the value from the first try block, which would be misleading.
Root Cause
The try block:
avatarConnectionRequest = await self._ensure_http_session().post(...) # line 130
body = await avatarConnectionRequest.text() # line 138
avatarConnectionRequest.raise_for_status() # line 139If line 130 raises, avatarConnectionRequest is undefined. The except handler:
f"...server returned {avatarConnectionRequest.status} and detail {body}"will crash with UnboundLocalError.
Impact: Network-level failures on the second request will cause an UnboundLocalError instead of a meaningful error log.
Was this helpful? React with 👍 or 👎 to provide feedback.
The livekit agents integration endpoint has changed and the old endpoint will be deprecated.