<p>I got the same error and had a hard time trying to figure out where to pass in the <code>-rpcwallet=&lt;wallet_name&gt;</code> flag. For example, I was doing a <code>bitcoin-cli listunspent -rpcwallet=&lt;wallet_name&gt;</code> and was getting the same error, until I changed things around and passed in the flag before the <code>listunspent</code> rpc command.</p>
<p>So always use the <code>-rpcwallet</code> flag before the rpc command you're working with.</p>
<p>For example:</p>
<p><code>bitcoin-cli -rpcwallet=&lt;wallet_name&gt; listunspent</code> will work, but <code>bitcoin-cli listunspent -rpcwallet=&lt;wallet_name&gt;</code> will return with the same error.</p>

CC BY-SA 4.0
2024-02-19T23:54:58.230Z
2024-02-19T23:54:58.230Z
Ifeanyichukwu Amajuoyi
<p><code>-rpcwallet</code> takes the name of the wallet, not the path to the datadir (as you appear to have done) or the path to the wallet file.</p>
<p>To get a list of the names of the wallets currently loaded, you can use the <code>listwallets</code> command.</p>

CC BY-SA 4.0
2020-11-15T00:25:30.180Z
2020-11-15T00:25:30.180Z
Ava Chow
<p>I would like to new address generate with this command</p>
<p><code>bitcoin-cli -testnet getnewaddress &quot;adr1&quot; &quot;p2sh-segwit&quot; </code> but I get this msg:</p>
<pre><code>error message:
Wallet file not specified (must request wallet RPC through /wallet/&lt;filename&gt; uri-path).
Try adding &quot;-rpcwallet=&lt;filename&gt;&quot; option to bitcoin-cli command line. 
</code></pre>
<p>then I added the -rpcwallet command like that:
<code>bitcoin-cli -testnet -rpcwallet=/home/bitcoin/.bitcoin/ getnewaddress &quot;adr1&quot; &quot;p2sh-segwit&quot; </code> but I got an error again like this:</p>
<pre><code>error message:
Requested wallet does not exist or is not loaded````

what should I do?

thank you
</code></pre>

<bitcoin-cli>
RPC getnewaddress error on v 0.20.0
sollover
# RPC getnewaddress error on v 0.20.0

(Asked by: username_0 on 2020-11-15)

I would like to new address generate with this command
bitcoin-cli -testnet getnewaddress "adr1" "p2sh-segwit"  but I get this msg:
error message:
Wallet file not specified (must request wallet RPC through /wallet/ uri-path).
Try adding "-rpcwallet=" option to bitcoin-cli command line. 

then I added the -rpcwallet command like that:
bitcoin-cli -testnet -rpcwallet=/home/bitcoin/.bitcoin/ getnewaddress "adr1" "p2sh-segwit"  but I got an error again like this:
error message:
Requested wallet does not exist or is not loaded````

what should I do?

thank you

**Tags:** bitcoin-cli


---

## 2 answers

### Answer by username_2 on 2020-11-15. Score: 4 | Accepted answer

`-rpcwallet` takes the name of the wallet, not the path to the datadir (as you appear to have done) or the path to the wallet file.

To get a list of the names of the wallets currently loaded, you can use the `listwallets` command.


---

### Answer by username_1 on 2024-02-19. Score: 0

I got the same error and had a hard time trying to figure out where to pass in the `-rpcwallet=` flag. For example, I was doing a `bitcoin-cli listunspent -rpcwallet=` and was getting the same error, until I changed things around and passed in the flag before the `listunspent` rpc command.

So always use the `-rpcwallet` flag before the rpc command you're working with.

For example:

`bitcoin-cli -rpcwallet= listunspent` will work, but `bitcoin-cli listunspent -rpcwallet=` will return with the same error.


---

