Skip to content

Fix poller crash: sync poller_sources on (type, name)#109

Merged
d3mocide merged 1 commit into
mainfrom
claude/gallant-fermi-az6m0q
Jun 16, 2026
Merged

Fix poller crash: sync poller_sources on (type, name)#109
d3mocide merged 1 commit into
mainfrom
claude/gallant-fermi-az6m0q

Conversation

@d3mocide

Copy link
Copy Markdown
Owner

Problem

The poller container crashes on startup with:

asyncpg.exceptions.UniqueViolationError: duplicate key value violates unique constraint "poller_sources_type_name_key"
DETAIL:  Key (type, name)=(meshcore, pyMC-Repeater) already exists.

Root cause

The poller_sources table enforces UNIQUE(type, name) (see db/init/03_sources.sql), but _sync_poller_sources in poller/config_sync.py deduplicated and matched rows on (type, url) instead.

After the recent "Replace RemoteTerm meshcore poller with pyMC-Repeater" change, the meshcore source's URL differed from what was already stored in the DB. Because the sync keyed on (type, url), the new (meshcore, <new_url>) pair wasn't found in the DB set, so the code attempted an INSERT — which collided with the existing row's (meshcore, pyMC-Repeater) (type, name) pair, raising UniqueViolationError and crashing the poller on every startup.

Fix

Key the sync on (type, name) to match the actual DB constraint, and treat url as a mutable property that is updated in place for existing config sources. This resolves the crash and correctly handles URL changes for an existing source going forward.

https://claude.ai/code/session_015f251CGMtsvJ5Vff4bEJCu


Generated by Claude Code

The DB enforces UNIQUE(type, name) on poller_sources, but the sync logic
deduplicated and matched on (type, url). When an existing source's URL
changed (e.g. the meshcore pyMC-Repeater migration), the new (type, url)
key was absent from the DB set, so the sync attempted an INSERT that
collided with the existing row's (type, name), raising
UniqueViolationError and crashing the poller on startup.

Key the sync on (type, name) to match the constraint and treat url as a
mutable property that is updated in place for existing config sources.
@d3mocide d3mocide marked this pull request as ready for review June 16, 2026 02:53
@d3mocide d3mocide merged commit d1eebb9 into main Jun 16, 2026
6 checks passed
@d3mocide d3mocide deleted the claude/gallant-fermi-az6m0q branch June 16, 2026 02:53
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