Migration tool is not working

I get following error while upgrading from v3 to v4

./chirpstack-v3-to-v4 --as-config-file /etc/chirpstack-application-server/chirpstack-application-server.toml --ns-config-file /etc/chirpstack-network-server/chirpstack-network-server.toml --cs-config-file /etc/chirpstack/chirpstack.toml
2022/10/10 16:15:30 Reading ChirpStack configuration file: /etc/chirpstack/chirpstack.toml
2022/10/10 16:15:30 Reading AS configuration file: /etc/chirpstack-application-server/chirpstack-application-server.toml
2022/10/10 16:15:30 Deleting users and tenants from target database
2022/10/10 16:15:30 Migrating users
2022/10/10 16:15:30 Migrating organizations
2022/10/10 16:15:30 Migrating organization users
2022/10/10 16:15:30 Migrating applications
2022/10/10 16:15:30 Reading NS configuration file: /etc/chirpstack-network-server/chirpstack-network-server.toml
2022/10/10 16:15:30 Migrating gateways
2022/10/10 16:15:30 Migrating device-profiles
panic: sql: no rows in result set

goroutine 1 [running]:
        /chirpstack-v3-to-v4/main.go:549 +0x7cc
main.run(0xa6a4b0, {0x1d24540, 0x0, 0x6})
        /chirpstack-v3-to-v4/main.go:113 +0x37c
github.com/spf13/cobra.(*Command).execute(0xa6a4b0, {0x1d020c8, 0x6, 0x7})
        /go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:856 +0x6b0
        /go/pkg/mod/github.com/spf13/cobra@v1.4.0/command.go:974 +0x414
        /chirpstack-v3-to-v4/main.go:79 +0x20

Try it with Chirpstack v4 running and v3 AS and NS not running

The status of chirpstack-application-server and chirpstack-network-server were stopped and Chirpstack v4 and chirpstack-gateway-bridge were running state.

The cause is probably that the record exists in one database, but not in the other (e.g. it exists in the NS DB, but not the AS DB). Maybe this should be logged as an error instead of a panic? I made it as a panic as I wanted it to fail in case of data-inconsistency.