Second Mac stops importing folder-sync changes with a UNIQUE constraint error on entry_aliases
Bug Details
After updating both Macs to 1AIVault 1.20.1, the first Mac now publishes again (the BUG-135 fix works there: all 18,992 changes written, 0 pending, three oversized records listed under "Too large to sync"). The second Mac, which joined the same plain-mode iCloud Drive folder sync space, cannot import them. Its last successful sync was more than 13 hours ago, and its acknowledgement file still says it has applied the first Mac's changes only up to sequence 7060, out of 18,992.
The sync space on the second Mac records last_error "UNIQUE constraint failed: entry_aliases.entry_id, entry_aliases.alias, entry_aliases.source". The app retries about once a minute (sync_spaces.updated_at moves forward each minute, last_sync_at does not) and the UI only shows "Scanning local vault in background". Its vault stays at 1,068 memories, so it never catches up.
What we checked, read-only. The next batch file (7061-7061) holds a single entry upsert whose payload has an empty aliases list, and that entry already exists on the second Mac with no rows in entry_aliases. Across all later batches (about 12,000 operations: entries, entry links, entry topics, topics, topic aliases, validity, skills) no payload has a duplicate (alias, source) pair, even after lower-casing and trimming. Every trigger in the database that writes entry_aliases uses INSERT OR IGNORE, so the plain insert that fails seems to come from the importer itself. One guess is that it inserts topic-derived aliases for an entry_topic or topic_alias operation that the entry_topics / topic_aliases triggers have already inserted, or that it re-applies aliases for an entry that was partly imported earlier. If the whole range is applied in one transaction, one such row blocks everything after it.
Expected: importing a remote change should be idempotent. Re-inserting an alias that already exists should be ignored (INSERT OR IGNORE or ON CONFLICT DO NOTHING), and one failing operation should not stop the import of every later change. It would also help if the error named the sequence number and record that failed, and if the Sync screen showed "Needs attention" instead of a scanning indicator that never finishes.
Steps to reproduce: on device A, build a vault with memories that have topics and topic aliases, plus agent aliases, and enable folder sync. Join the same folder from device B with an existing small vault, let it import part of the history, then keep importing. Device B stops with the error above and never advances its acknowledgement.
Reproducibility: Unknown · Impact: Minor issue
Environment
- VERSION
- 1.20.1
- OS
- macOS 26.5
- ARCH
- —
- CHANNEL
- —
Resolution progress
PENDING
REVIEWING
—
IN PROGRESS
COMPLETED
—
- — ThanhLinh submitted this request
- — Khoa - StoicSoft Team moved it to In progress
Discussion0
Newest first- No comments yet. Add context or ask a question below.
Sign in to comment, vote and follow this request.
Sign in to reply