fix: handle empty messages in login error and warn about special characters#65
Open
kwaczek wants to merge 1 commit intodvejsada:masterfrom
Open
fix: handle empty messages in login error and warn about special characters#65kwaczek wants to merge 1 commit intodvejsada:masterfrom
kwaczek wants to merge 1 commit intodvejsada:masterfrom
Conversation
…acters When login fails with an empty messages array, the integration crashed with IndexError. This now handles that gracefully and provides a helpful error message suggesting the user check for special characters in their password, which Rohlik.cz may not handle correctly on the server side. Also adds a note to the README about this known limitation. Closes dvejsada#63 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes a crash in the Rohlik.cz Home Assistant integration when the login API returns an empty messages array, and adds user-facing guidance about password special-character login failures.
Changes:
- Hardened login error handling to avoid
IndexErrorwhenmessagesis empty and to provide a fallback error detail. - Added a README configuration note warning that certain special characters in passwords may cause login failures.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
custom_components/rohlikcz/rohlik_api.py |
Safely handles empty messages in login failure responses and improves fallback error messaging/logging. |
readme.md |
Adds a configuration note about potential login issues with special characters in passwords. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Fixes #63
messagesarray, the integration crashed withIndexError: list index out of range. This is now handled gracefully.Root cause
Rohlik.cz server doesn't properly handle certain special characters in passwords (e.g. backtick
`). When such a password is sent, the server returns a 401 response with an emptymessagesarray instead of the usual error message. The original code assumedmessageswould always have at least one element.Test plan
messagesarray without crashing🤖 Generated with Claude Code