This is the error I get:

```
$ bitcoin-cli -rpcwallet=descriptor -testnet upgradewallet                         <
error code: -1
error message:
wallet/rpcwallet.cpp:4522 (operator())
Internal bug detected: '!error.empty()'
You may report this issue here: https://github.com/bitcoin/bitcoin/issues
```

The daemon logs this:

```
2021-07-15T16:16:54Z [descriptor] Performing wallet upgrade to 169900
```

**Expected behavior**

When I do the same on the default (non-descriptor) wallet:

```
$ bitcoin-cli -rpcwallet="" -testnet upgradewallet                             
{
  "wallet_name": "",
  "previous_version": 169900,
  "current_version": 169900,
  "result": "Already at latest version. Wallet version unchanged."
}
```

<!-- **Actual behavior** -->

<!-- See above. Isn't this kind of backwards, to first ask what I expect and then ask what I got? I am writing here because I got something strange in the first place... -->

**System information**

Bitcoin Core v0.21.1 Linux x86_64 glibc (Ubuntu) using binarias from bitcoincore.org

:   ScriptPubKeyMan(storage),
            m_wallet_descriptor(descriptor)
        {}
    DescriptorScriptPubKeyMan(WalletStorage& storage)
        :   ScriptPubKeyMan(storage)
        {}
    mutable RecursiveMutex cs_desc_man;
    bool GetNewDestination(const OutputType type, CTxDestination& dest, std::string& error) override;
    isminetype IsMine(const CScript& script) const override;
    bool CheckDecryptionKey(const CKeyingMaterial& master_key, bool accept_no_keys = false) override;
    bool Encrypt(const CKeyingMaterial& master_key, WalletBatch* batch) override;
    bool GetReservedDestination(const OutputType type, bool internal, CTxDestination& address, int64_t& index, CKeyPool& keypool, std::string& error) override;
    void ReturnDestination(int64_t index, bool internal, const CTxDestination& addr) override;
    
    
    
    
    bool TopUp(unsigned int size = 0) override;
    void MarkUnusedAddresses(const CScript& script) override;
    bool IsHDEnabled() const override;
    
    bool SetupDescriptorGeneration(const CExtKey& master_key, OutputType addr_type, bool internal);
    /** Provide a descriptor at setup time