### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current behaviour

crash

### Expected behaviour

no crash

### Steps to reproduce

* Compile 79e8247ddb166f9b980f40249b7372a502402a4d
* Type `migratewallet`

### Relevant log output

```
wallet/scriptpubkeyman.cpp:1915: std::optional<MigrationData> wallet::LegacyScriptPubKeyMan::MigrateToDescriptor(): Assertion `IsMine(desc_spk) != ISMINE_NO' failed.
Aborted (core dumped)
```


### How did you obtain Bitcoin Core

Compiled from source

### What version of Bitcoin Core are you using?

current master

### Operating system and version

Linux

### Machine specifications

_No response_
// All good
        result.emplace_back(dest);
    });
    return result;
}
stdset<stdstring> CWalListAddrBookLabels(const stdoptional<AddressPurpose> purpose) const
{
    AssertLockHeld(cs_wal);
    stdset<stdstring> label_set;
    ForEachAddrBookEntry([&](const CTxDestination& _dest, const stdstring& _label,
                             bool _is_change, const stdoptional<AddressPurpose>& _purpose) {
        if (_is_change) return;
        if (!purpose || purpose == _purpose) {
            label_set.insert(_label);
        }
    });
    return label_set;
}
utilResult<CTxDestination> ReserveDestinationGetReservedDestination(bool internal)
{
    m_spk_man = pwal->GetScriptPubKeyMan(type, internal);
    if (!m_spk_man) {
        return utilError{strprintf(_("Error No %s addresses available."), FormatOutputType(type))};
    }
    if (nIndex == -1) {
        CKeyPool keypool;
        auto op_address = m_spk_man->GetReservedDestination(type, internal, nIndex, keypool);
        if (!op_address) return op_address;
        address = *op_address;
        fInternal = keypool.fInternal;