[GH-ISSUE #5562] Migration MySQL error on start: Error 1061 (42000): Duplicate key name 'idx_services_domain' #10790

Open
opened 2026-08-05 01:27:17 -04:00 by saavagebueno · 3 comments
Owner

Originally created by @th3-sh0w3r on GitHub (Mar 10, 2026).
Original GitHub issue: https://github.com/netbirdio/netbird/issues/5562

Describe the problem

In tonights update (I have automatic updates enabled via watchtower in composer) the netbird-server breaks because of this:

2026-03-10T08:43:16.498Z INFO combined/cmd/root.go:289: Management server created
2026-03-10T08:43:16.499Z INFO combined/cmd/root.go:305: Signal server created
2026-03-10T08:43:16.500Z INFO management/server/store/store.go:369: using MySQL store engine
2026-03-10T08:43:16.522Z INFO management/server/store/sql_store.go:104: Setting transaction timeout to 5m0s
2026-03-10T08:43:16.522Z INFO management/server/store/sql_store.go:118: Set max open db connections to 2, max idle to 2, max lifetime to 1h0m0s, max idle time to 3m0s
2026-03-10T08:43:16.561Z INFO management/server/migration/migration.go:263: No plain setup keys found in table setup_keys, no migration needed
2026-03-10T08:43:16.561Z INFO management/server/migration/migration.go:301: Migration of plain setup key to hashed setup key completed
2026-03-10T08:43:16.567Z INFO management/server/migration/migration.go:344: No rows with empty enabled found in table network_resources, no migration needed
2026-03-10T08:43:16.568Z INFO management/server/migration/migration.go:358: Migration of empty enabled to default value in table network_resources completed
2026-03-10T08:43:16.574Z INFO management/server/migration/migration.go:344: No rows with empty enabled found in table network_routers, no migration needed
2026-03-10T08:43:16.575Z INFO management/server/migration/migration.go:358: Migration of empty enabled to default value in table network_routers completed
2026-03-10T08:43:16.601Z INFO management/server/migration/migration.go:344: No rows with empty name found in table users, no migration needed
2026-03-10T08:43:16.601Z INFO management/server/migration/migration.go:358: Migration of empty name to default value in table users completed
2026-03-10T08:43:16.609Z INFO management/server/migration/migration.go:344: No rows with empty email found in table users, no migration needed
2026-03-10T08:43:16.609Z INFO management/server/migration/migration.go:358: Migration of empty email to default value in table users completed
2026-03-10T08:43:16.981Z FATL management/internals/server/boot.go:64: failed to create store: auto migratePreAuto: Error 1061 (42000): Duplicate key name 'idx_services_domain'

I had to delete the key manually now and restart so that it works and doesn't hang in a boot loop.
I have to turn off automatic updates now, because I can't trust the updates before personally checking them...

To Reproduce

Steps to reproduce the behavior:

  1. Have version 0.66.2 installed
  2. Automatic update with restart at night
  3. ERROR

Expected behavior

The netbird-server container should start already

Are you using NetBird Cloud?

No, self-hosted

NetBird version

0.66.2

Is any other VPN software installed?

No

Debug output

Is shown above

Screenshots

Additional context

Have you tried these troubleshooting steps?

Originally created by @th3-sh0w3r on GitHub (Mar 10, 2026). Original GitHub issue: https://github.com/netbirdio/netbird/issues/5562 **Describe the problem** In tonights update (I have automatic updates enabled via watchtower in composer) the netbird-server breaks because of this: 2026-03-10T08:43:16.498Z INFO combined/cmd/root.go:289: Management server created 2026-03-10T08:43:16.499Z INFO combined/cmd/root.go:305: Signal server created 2026-03-10T08:43:16.500Z INFO management/server/store/store.go:369: using MySQL store engine 2026-03-10T08:43:16.522Z INFO management/server/store/sql_store.go:104: Setting transaction timeout to 5m0s 2026-03-10T08:43:16.522Z INFO management/server/store/sql_store.go:118: Set max open db connections to 2, max idle to 2, max lifetime to 1h0m0s, max idle time to 3m0s 2026-03-10T08:43:16.561Z INFO management/server/migration/migration.go:263: No plain setup keys found in table setup_keys, no migration needed 2026-03-10T08:43:16.561Z INFO management/server/migration/migration.go:301: Migration of plain setup key to hashed setup key completed 2026-03-10T08:43:16.567Z INFO management/server/migration/migration.go:344: No rows with empty enabled found in table network_resources, no migration needed 2026-03-10T08:43:16.568Z INFO management/server/migration/migration.go:358: Migration of empty enabled to default value in table network_resources completed 2026-03-10T08:43:16.574Z INFO management/server/migration/migration.go:344: No rows with empty enabled found in table network_routers, no migration needed 2026-03-10T08:43:16.575Z INFO management/server/migration/migration.go:358: Migration of empty enabled to default value in table network_routers completed 2026-03-10T08:43:16.601Z INFO management/server/migration/migration.go:344: No rows with empty name found in table users, no migration needed 2026-03-10T08:43:16.601Z INFO management/server/migration/migration.go:358: Migration of empty name to default value in table users completed 2026-03-10T08:43:16.609Z INFO management/server/migration/migration.go:344: No rows with empty email found in table users, no migration needed 2026-03-10T08:43:16.609Z INFO management/server/migration/migration.go:358: Migration of empty email to default value in table users completed 2026-03-10T08:43:16.981Z FATL management/internals/server/boot.go:64: failed to create store: auto migratePreAuto: Error 1061 (42000): Duplicate key name 'idx_services_domain' I had to delete the key manually now and restart so that it works and doesn't hang in a boot loop. I have to turn off automatic updates now, because I can't trust the updates before personally checking them... **To Reproduce** Steps to reproduce the behavior: 1. Have version 0.66.2 installed 2. Automatic update with restart at night 3. ERROR **Expected behavior** The netbird-server container should start already **Are you using NetBird Cloud?** No, self-hosted **NetBird version** 0.66.2 **Is any other VPN software installed?** No **Debug output** Is shown above **Screenshots** - **Additional context** - **Have you tried these troubleshooting steps?** -
saavagebueno added the triage-needed label 2026-08-05 01:27:17 -04:00
Author
Owner

@ressys1978 commented on GitHub (Mar 10, 2026):

I too can confirm this issue with v0.66.2.

2026-03-10T11:04:28.577Z FATL management/internals/server/boot.go:64: failed to create store: auto migratePreAuto: Error 1061 (42000): Duplicate key name 'idx_services_domain'

Rolling back to v0.66.1 allows the Management service to work.

When creating an Index, there should be a process that checks to see if one with the same name already exists first, check to see if the index is the same, delete and recreate it if necessary, or skip creating if it is not needed.

<!-- gh-comment-id:4030646277 --> @ressys1978 commented on GitHub (Mar 10, 2026): I too can confirm this issue with v0.66.2. 2026-03-10T11:04:28.577Z FATL management/internals/server/boot.go:64: failed to create store: auto migratePreAuto: Error 1061 (42000): Duplicate key name 'idx_services_domain' Rolling back to v0.66.1 allows the Management service to work. When creating an Index, there should be a process that checks to see if one with the same name already exists first, check to see if the index is the same, delete and recreate it if necessary, or skip creating if it is not needed.
Author
Owner

@Westie commented on GitHub (Mar 10, 2026):

Can also confirm problem this exists.

In my case, I was updating to 0.66.3 and that failed. Have manually rolled back to 0.66.2

<!-- gh-comment-id:4033201597 --> @Westie commented on GitHub (Mar 10, 2026): Can also confirm problem this exists. In my case, I was updating to 0.66.3 and that failed. Have manually rolled back to 0.66.2
Author
Owner

@Westie commented on GitHub (Mar 12, 2026):

@mlsmaycon do you happen to have any CI/CD pipelines for those using MySQL, btw?

<!-- gh-comment-id:4048784001 --> @Westie commented on GitHub (Mar 12, 2026): @mlsmaycon do you happen to have any CI/CD pipelines for those using MySQL, btw?
Sign in to join this conversation.
No Label triage-needed
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#10790