<p>I've been reading the source code of Electrum, and it turns out that the reason why you can't find anything about this is that it's not an Electrum error-it's an error generated by the Bitcoin client, and Electrum is just passing it along.</p>

<p>Now, what causes the error?</p>

<p>There are a bunch of ways it can happen (like trying to send a coinbase transaction), but the number one way that this can happen is if you send the same transaction twice. Unfortunatly, the current implementation of <code>sendrawtransaction</code> doesn't really give you any information about why.</p>

<p>(For those that are interested, the relevant error is on <a href="https://github.com/bitcoin/bitcoin/blob/master/src/rpcrawtransaction.cpp#L555" rel="nofollow">line 555 of rpcrawtransaction.cpp</a>.</p>

CC BY-SA 3.0
2013-03-15T13:46:30.183Z
Thanks for interesting reply, but although I see "TX rejected" on Line 555, I can't find a reference to "code:-22". Is there a list somewhere of error messages, including "22"?
user3352
CC BY-SA 3.0
2013-03-15T16:19:58.203Z
That's what the constant `RPC_DESERIALIZATION_ERROR` comes out to. PS: You're looking for -22, not 22.
Nick ODell
CC BY-SA 3.0
2013-06-21T23:15:20.407Z
@user3352 the codes are in https://github.com/bitcoin/bitcoin/blob/master/src/bitcoinrpc.h
Ponkadoodle
CC BY-SA 3.0
2013-03-15T03:04:28.367Z
2013-03-15T03:04:28.367Z
Nick ODell
<p>When I try to send BTC from my Electrum wallet address to one of my unused addresses in Electrum, just as a test, it comes up with an error message <code>(U'message':u'TX rejected, U'code':-22)</code>.
I'm using electrum-1.6.2 Install version on my Windows 7 64-bit PC.</p>

<p>I changed the Electrum server and then the transmission worked, so I guess it was an error transmitting data to the server.</p>

<p>Can someone confirm that Error "22" refers to a transmission error to the server?
Also, is there a list of error message numbers, so in future I can refer to the list?</p>

<address><electrum><error>
Electrum Error Message "22"
user3352
# Electrum Error Message "22"

(Asked by: username_0 on 2013-03-15)

When I try to send BTC from my Electrum wallet address to one of my unused addresses in Electrum, just as a test, it comes up with an error message `(U'message':u'TX rejected, U'code':-22)`.
I'm using electrum-1.6.2 Install version on my Windows 7 64-bit PC.

I changed the Electrum server and then the transmission worked, so I guess it was an error transmitting data to the server.

Can someone confirm that Error "22" refers to a transmission error to the server?
Also, is there a list of error message numbers, so in future I can refer to the list?

**Tags:** address, electrum, error


---

## 1 answers

### Answer by username_1 on 2013-03-15. Score: 1

I've been reading the source code of Electrum, and it turns out that the reason why you can't find anything about this is that it's not an Electrum error-it's an error generated by the Bitcoin client, and Electrum is just passing it along.

Now, what causes the error?

There are a bunch of ways it can happen (like trying to send a coinbase transaction), but the number one way that this can happen is if you send the same transaction twice. Unfortunatly, the current implementation of `sendrawtransaction` doesn't really give you any information about why.

(For those that are interested, the relevant error is on [line 555 of rpcrawtransaction.cpp](https://github.com/bitcoin/bitcoin/blob/master/src/rpcrawtransaction.cpp#L555).

> **Comments:**
> **username_0**: Thanks for interesting reply, but although I see "TX rejected" on Line 555, I can't find a reference to "code:-22". Is there a list somewhere of error messages, including "22"?  
> **username_1**: That's what the constant `RPC_DESERIALIZATION_ERROR` comes out to. PS: You're looking for -22, not 22.  
> **username_2**: @username_0 the codes are in https://github.com/bitcoin/bitcoin/blob/master/src/bitcoinrpc.h  

---

