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

virtual void SetMinVersion(enum WalletFeature, WalletBatch* = nullptr) = 0;
    virtual const CKeyingMaterial& GetEncryptionKey() const = 0;
    virtual bool HasEncryptionKeys() const = 0;
    virtual bool IsLocked() const = 0;
};
static const unsigned int DEFAULT_KEYPOOL_SIZE = 1000;
std::vector<CKeyID> GetAffectedKeys(const CScript& spk, const SigningProvider& provider);
/** A key from a CWallet's keypool
 *
 * The wallet holds one (for pre HD-split wallets) or several keypools. These
 * are sets of keys that have not yet been used to provide addresses or receive
 * change.
 *
 * The Bitcoin Core wallet was originally a collection of unrelated private
 * keys with their associated addresses. If a non-HD wallet generated a
 * key/address, gave that address out and then restored a backup from before
 * that key's generation, then any funds sent to that address would be
 * lost definitively.
 *
 * The keypool was implemented to avoid this scenario (commit: 10384941). The
 * wallet would generate a set of keys (100 by default). When a new public key
 * was required, either to give out as an address or to use in a change output,
 * it would be drawn from the keypool. The keypool would then be topped up to
 * maintain 100 keys. This ensured that as long as the wallet hadn't used more
 * than 100 keys since the previous backup, all funds would be safe, since a
 * restored wallet would be able to scan for all owned addresses.
 *