Skip to content

sync failed: sync labels: UNIQUE constraint failed: labels.source_id, labels.name #232

@protonchang

Description

@protonchang

I am encountering an error when running both the sync and sync-full commands. I’m not entirely sure of the root cause, but it happens consistently in my environment.

Outputs:

$ msgvault sync <REDACTED>@gmail.com -v
Starting incremental sync for <REDACTED>@gmail.com
Last history ID: 12315196

time=2026-03-29T20:00:38.319+08:00 level=INFO msg="incremental sync" email=<REDACTED>@gmail.com start_history=12315196 current_history=16510615

Errors:
  <REDACTED>@gmail.com: sync failed: sync labels: UNIQUE constraint failed: labels.source_id, labels.name
Error: 1 account(s) failed to sync: <REDACTED>@gmail.com: sync failed: sync labels: UNIQUE constraint failed: labels.source_id, labels.name
Usage:
  msgvault sync [email] [flags]

Aliases:
  sync, sync-incremental

Flags:
  -h, --help   help for sync

Global Flags:
      --config string   config file (default: ~/.msgvault/config.toml)
      --home string     home directory (overrides MSGVAULT_HOME)
      --local           force local database (override remote config)
  -v, --verbose         verbose output
msgvault sync-full <REDACTED>@gmail.com -v
Starting full sync for <REDACTED>@gmail.com

Errors:
  <REDACTED>@gmail.com: sync failed: sync labels: UNIQUE constraint failed: labels.source_id, labels.name
Error: 1 account(s) failed to sync: <REDACTED>@gmail.com: sync failed: sync labels: UNIQUE constraint failed: labels.source_id, labels.name
Usage:
  msgvault sync-full [email] [flags]

Flags:
      --after string    Only messages after this date (YYYY-MM-DD)
      --before string   Only messages before this date (YYYY-MM-DD)
  -h, --help            help for sync-full
      --limit int       Limit number of messages (for testing)
      --noresume        Force fresh sync (don't resume)
      --query string    Gmail search query

Global Flags:
      --config string   config file (default: ~/.msgvault/config.toml)
      --home string     home directory (overrides MSGVAULT_HOME)
      --local           force local database (override remote config)
  -v, --verbose         verbose output

Version

msgvault v0.11.0
  commit:  f6ed6386
  built:   2026-03-25T00:24:15Z
  go:      go1.25.8
  os/arch: darwin/arm64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions