Repository navigation
Fix "Migration handler not found" after upgrading to 3.0.0 (3.0.1) - #47
Merged
Merged
Conversation
Releases before 3.0.0 declared the config flow VERSION as 0.1, so existing
entries are stored with that version. 3.0.0 raised VERSION to 1 without an
async_migrate_entry handler, so Home Assistant refused to load those entries
("Migration handler not found"). The stored data is unchanged, so the
migration only raises the entry version to 1.
Fixes #46
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LYz7Z1Ewux6CkjNqGF9rMJ
The backfill ran on every setup and reload. It is now the 1.1 -> 1.2 step of async_migrate_entry (config flow MINOR_VERSION = 2), so it runs once per entry. Entries with a newer major version are refused instead of loaded. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LYz7Z1Ewux6CkjNqGF9rMJ
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.
Fixes #46.
Cause
Releases before 3.0.0 set the config flow
VERSION = 0.1, so every existing config entry is stored with version 0.1. Version 3.0.0 raisedVERSIONto1but added noasync_migrate_entry. When Home Assistant loads an old entry, it sees the version mismatch, logsMigration handler not found for entry … for pid_departures, and leaves the entry inMIGRATION_ERROR. As a result, every board set up before 3.0.0 stops loading. New installs are not affected.Changes
__init__.py: add a versionedasync_migrate_entrywith debug logging:async_setup_entryon every setup and reload; it now runs once per entry.config_flow.py: addMINOR_VERSION = 2, so new entries are created at 1.2.manifest.json: bump to3.0.1..gitignorefor__pycache__/and*.pyc.Users already on 3.0.0
A failed migration doesn't write anything, so their old entries are still stored as version 0.1 with the original data. Boards added on 3.0.0 are stored as 1.1 and migrate to 1.2 without changes. Updating to 3.0.1 and restarting is enough. They should not delete and re-add their boards, since that would replace the existing entities.
Testing
Tested on Home Assistant 2026.2.3 with
pytest-homeassistant-custom-component. The tests patch outasync_setup_entry, so no API calls are made.Migration handler not found for entry x x B for pid_departuresand stateMIGRATION_ERROR, and its version stays 0.1.LOADEDat 1.2, with unique ID = stop ID and its data unchanged.MIGRATION_ERROR.The repo has no test suite, so the tests are not included in this PR.
Notes
🤖 Generated with Claude Code
https://claude.ai/code/session_01LYz7Z1Ewux6CkjNqGF9rMJ