### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current behaviour

Bitcoin Core behaves unexpectedly or even crashes.

* `getnewaddress "" unknown`: "Error: No unknown addresses available. (code -12)"
* `getrawchangeaddress unknown`: "Error: No unknown addresses available. (code -12)"
* `createmultisig 2 '["03789ed0bb717d88f7d321a368d905e7430207ebbd82bd342cf11ae157a7ace5fd", "03dbc6764b8884a92e871274b87583e6d5c2a58819473e17e107ef3f6aa5a61626"]' unknown`: Bitcoin-Qt crashes with Assertion Error: "bitcoin-qt: outputtype.cpp:110: CTxDestination AddAndGetDestinationForScript(FillableSigningProvider&, const CScript&, OutputType): Assertion `false' failed."
* Bitcoin-Qt can be started with `-addresstype=unknown` or `-changetype=unknown` without any error message.

### Expected behaviour

Bitcoin Core tells me something like "Unknown address type 'unknown' (code -5)", as if I used any type that is not `legacy`, `p2sh-segwit`, `bech32`, or `bech32m`.

### Steps to reproduce

Open Bitcoin-Qt Console, create/open a wallet with appropriate settings if necessary, and run the commands above.

Or start it with  `-addresstype=unknown` or` -changetype=unknown`.

### Relevant log output

_No response_

### How did you obtain Bitcoin Core

Compiled from source

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

master@b22c275582cc

### Operating system and version

Debian 12 (Testing)

### Machine specifications

_No response_
{
    if (type == OUTPUT_TYPE_STRING_LEGACY) {
        return OutputType::LEGACY;
    } else if (type == OUTPUT_TYPE_STRING_P2SH_SEGWIT) {
        return OutputType::P2SH_SEGWIT;
    } else if (type == OUTPUT_TYPE_STRING_BECH32) {
        return OutputType::BECH32;
    } else if (type == OUTPUT_TYPE_STRING_BECH32M) {
        return OutputType::BECH32M;
    } else if (type == OUTPUT_TYPE_STRING_UNKNOWN) {
        return OutputType::UNKNOWN;
    }
    return std::nullopt;
}
const std::string& FormatOutputType(OutputType type)
{
    switch (type) {
    case OutputType::LEGACY: return OUTPUT_TYPE_STRING_LEGACY;
    case OutputType::P2SH_SEGWIT: return OUTPUT_TYPE_STRING_P2SH_SEGWIT;
    case OutputType::BECH32: return OUTPUT_TYPE_STRING_BECH32;
    case OutputType::BECH32M: return OUTPUT_TYPE_STRING_BECH32M;
    case OutputType::UNKNOWN: return OUTPUT_TYPE_STRING_UNKNOWN;
    } 
    assert(false);
}
CTxDestination GetDestinationForKey(const CPubKey& key, OutputType type)