Skip to content

Conversation

@allenporter
Copy link
Contributor

Fixes this error message:

Uncaught error in callback 'find_response': 'utf-8' codec can't decode byte 0x9d in position 24: invalid start byte 2025-12-04 08:02:40.468 

This will cause invalid mqtt messages to be ignored and not logged. I suspect this is normal when attempting to parse an mqtt message as a map message? Or may indicate another problem we have not yet diagnosed, but still needed.

Copilot AI review requested due to automatic review settings December 4, 2025 15:39
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a crash caused by UnicodeDecodeError when attempting to decode MQTT messages with invalid UTF-8 bytes. The fix ensures that such messages are properly caught and logged as exceptions rather than causing uncaught errors.

  • Adds UnicodeDecodeError to the exception handling in the V1 protocol message decoder
  • Adds comprehensive test coverage for invalid UTF-8 byte scenarios

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
roborock/protocols/v1_protocol.py Adds UnicodeDecodeError to the exception tuple when decoding message payloads to prevent crashes from invalid UTF-8 bytes
tests/protocols/test_v1_protocol.py Adds test case test_invalid_unicode() to verify proper exception handling for messages with invalid UTF-8 bytes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@allenporter allenporter merged commit e8c3b75 into Python-roborock:main Dec 4, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants