#16250 added a JSONRPCError(RPC_INVALID_PARAMETER, "Missing redeemScript/witnessScript") error in src/rpc/rawtransaction_util.cpp in case both the redeemScript and witnessScript are missing. Just before that, a RPCTypeCheckObj() is called with fAllowNull=True. If fAllowNull had been false, this function would have thrown a JSONRPCError(RPC_TYPE_ERROR, "Missing redeemScript")
I'm not sure which error is the right one for this case, between RPC_INVALID_PARAMETER and RPC_TYPE_ERROR, but I feel like it should be the same in both case.