<p>I feel your pain, I do think that these APIs need some more love at the level of usability. I am planning to spend some time on it because I had some problems too.</p>
<p>But before calling it a bug, we need to try to check if the workflow is the correct one.</p>
<p>Step 1: Create a wallet;
Step 1.1: Check if the wallet exists, if yes load it (in the URL you do not need to specify the <code>/wallet/&lt;name_wallet&gt;</code>)
Step 2: import your descriptors (you should work)</p>
<p>From the error that you gave, and from my experience I think
your wallet is not loaded, maybe because you are using the wrong URL (and here the question is why core is not failing?)</p>
<p>Keep us posted!</p>

CC BY-SA 4.0
2023-08-13T08:55:18.207Z
2023-08-13T08:55:18.207Z
vincenzopalazzo
<p>I am running the following request to load a wallet.</p>
<pre><code>curl --location 'user:password@umbrel.local:8332/wallet/test_multisig&quot;' \
--header 'Content-Type: text/plain' \
--data '{
    &quot;jsonrpc&quot;: &quot;2.0&quot;,
    &quot;method&quot;:&quot;loadwallet&quot;,
    &quot;params&quot;: [&quot;test_multisig&quot;],
    &quot;id&quot;: &quot;test_multisig_wallet_load&quot;
}'
</code></pre>
<p>It returns...</p>
<p><code>{&quot;result&quot;:null,&quot;error&quot;:{&quot;code&quot;:-35,&quot;message&quot;:&quot;Wallet \&quot;test_multisig\&quot; is already loaded.&quot;},&quot;id&quot;:&quot;test_multisig_wallet_load&quot;} </code></p>
<p>However I then run this exact request, and receive an error as if the wallet is not loaded.</p>
<pre><code>curl --location 'user:password@umbrel.local:8332/wallet/test_multisig&quot;' \
--header 'Content-Type: text/plain' \
--data '{
    &quot;jsonrpc&quot;: &quot;2.0&quot;,
    &quot;method&quot;:&quot;importdescriptors&quot;,
    &quot;params&quot;:{
        &quot;requests&quot;:[{
        &quot;desc&quot;:&quot;pkh(cSQPHDBwXGjVzWRqAHm6zfvQhaTuj1f2bFH58h55ghbjtFwvmeXR)&quot;,
        &quot;active&quot;: false,
        &quot;range&quot;: 20,
        &quot;next_index&quot;: 0,
        &quot;timestamp&quot;: &quot;now&quot;, 
        &quot;internal&quot;: false,
        &quot;label&quot;: &quot;test_multisig_wallet&quot;
        }]
    }
}'
</code></pre>
<p>Error...
<code>{&quot;result&quot;:null,&quot;error&quot;:{&quot;code&quot;:-18,&quot;message&quot;:&quot;Requested wallet does not exist or is not loaded&quot;},&quot;id&quot;:null} </code></p>
<p>How can I import descriptors into a wallet so the wallet has a sequence of addresses?</p>

CC BY-SA 4.0
2023-07-19T16:57:58.773Z
What is the output of `listwallets`?
Pieter Wuille
CC BY-SA 4.0
2023-07-19T19:25:43.437Z
That wallet and a few others are listed. @PieterWuille
Joe
CC BY-SA 4.0
2023-07-19T20:34:30.997Z
@PieterWuille The full result for `listwallets` is `{"result":["test_multisig","wallet2","wallet3"],"error":null,"id":"testWallet"}`. I receive the same error when running `importdescriptors` on all of these wallets.
Joe
<bitcoin-core><wallet><json-rpc><output-script-descriptors><wallet-import>
Bitcoin Core RPC cURL - importdescriptors failing on loaded wallet
Joe
# Bitcoin Core RPC cURL - importdescriptors failing on loaded wallet

(Asked by: username_0 on 2023-07-19)

I am running the following request to load a wallet.

```
curl --location 'user:password@umbrel.local:8332/wallet/test_multisig"' \
--header 'Content-Type: text/plain' \
--data '{
    "jsonrpc": "2.0",
    "method":"loadwallet",
    "params": ["test_multisig"],
    "id": "test_multisig_wallet_load"
}'

```

It returns...

`{"result":null,"error":{"code":-35,"message":"Wallet \"test_multisig\" is already loaded."},"id":"test_multisig_wallet_load"}`

However I then run this exact request, and receive an error as if the wallet is not loaded.

```
curl --location 'user:password@umbrel.local:8332/wallet/test_multisig"' \
--header 'Content-Type: text/plain' \
--data '{
    "jsonrpc": "2.0",
    "method":"importdescriptors",
    "params":{
        "requests":[{
        "desc":"pkh(cSQPHDBwXGjVzWRqAHm6zfvQhaTuj1f2bFH58h55ghbjtFwvmeXR)",
        "active": false,
        "range": 20,
        "next_index": 0,
        "timestamp": "now", 
        "internal": false,
        "label": "test_multisig_wallet"
        }]
    }
}'

```

Error...
`{"result":null,"error":{"code":-18,"message":"Requested wallet does not exist or is not loaded"},"id":null}`

How can I import descriptors into a wallet so the wallet has a sequence of addresses?

**Tags:** bitcoin-core, wallet, json-rpc, output-script-descriptors, wallet-import

> **Comments:**
> **username_1**: What is the output of `listwallets`?  
> **username_0**: That wallet and a few others are listed. @username_1  
> **username_0**: @username_1 The full result for `listwallets` is `{"result":["test_multisig","wallet2","wallet3"],"error":null,"id":"testWallet"}`. I receive the same error when running `importdescriptors` on all of these wallets.  

---

## 1 answers

### Answer by username_2 on 2023-08-13. Score: 0

I feel your pain, I do think that these APIs need some more love at the level of usability. I am planning to spend some time on it because I had some problems too.

But before calling it a bug, we need to try to check if the workflow is the correct one.

Step 1: Create a wallet;
Step 1.1: Check if the wallet exists, if yes load it (in the URL you do not need to specify the `/wallet/<name_wallet>`)
Step 2: import your descriptors (you should work)

From the error that you gave, and from my experience I think
your wallet is not loaded, maybe because you are using the wrong URL (and here the question is why core is not failing?)

Keep us posted!


---

