v2rayA/v2rayA · error

system config count mismatch: BoltDB=%d, SQLite=%d

Error message

system config count mismatch: BoltDB=%d, SQLite=%d

What it means

Post-migration integrity check in verifyMigration: the number of rows migrated into system_config differs from the count of entries in the BoltDB "system" bucket, meaning the migration dropped or duplicated system configuration; both counts are reported and the migration is treated as failed.

Source

Thrown at service/db/migrate.go:530

// verifyMigration compares data counts between BoltDB and SQLite
func verifyMigration(boltDB *bbolt.DB, sqldb *sql.DB) error {
	log.Info("Verifying migration integrity...")

	err := boltDB.View(func(btx *bbolt.Tx) error {
		// Verify system config
		systemBkt := btx.Bucket([]byte("system"))
		if systemBkt != nil {
			var boltCount int
			systemBkt.ForEach(func(_, _ []byte) error {
				boltCount++
				return nil
			})

			var sqlCount int
			sqldb.QueryRow("SELECT COUNT(*) FROM system_config").Scan(&sqlCount)

			if boltCount != sqlCount {
				return fmt.Errorf("system config count mismatch: BoltDB=%d, SQLite=%d", boltCount, sqlCount)
			}
			log.Info("System config: %d entries verified", boltCount)
		}

		// Verify servers
		touchBkt := btx.Bucket([]byte("touch"))
		if touchBkt != nil {
			serversData := touchBkt.Get([]byte("servers"))
			if serversData != nil {
				boltServerCount := len(gjson.ParseBytes(serversData).Array())
				var sqlServerCount int
				sqldb.QueryRow("SELECT COUNT(*) FROM servers WHERE type = 'server'").Scan(&sqlServerCount)
				if boltServerCount != sqlServerCount {
					return fmt.Errorf("server count mismatch: BoltDB=%d, SQLite=%d", boltServerCount, sqlServerCount)
				}
				log.Info("Servers: %d entries verified", boltServerCount)
			}

View on GitHub (pinned to 71e5442fc5)

Solutions

  1. Delete the SQLite DB and rerun migration
  2. Restore BoltDB from backup before retrying
  3. Manually diff system keys to find missing entries
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at service/db/migrate.go:530 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of v2rayA/v2rayA@71e5442fc5 (2026-09-05). Data as JSON: /api/errors/e50ec744d6764f19. Report an issue: GitHub.