cast send '-32000 replacement transaction underpriced': stuck same-nonce tx, use --resend with higher --priority-gas-price
cast send rejects the transaction before it reaches a block:
(code: -32000, message: replacement transaction underpriced, data: None)This is a mempool-level rejection, not a contract or ABI problem. The node already holds a pending transaction from your address with the same nonce, and the new one does not beat it by the node's required margin (typically a ~10% bump on the fee fields), so it refuses to replace it. cast send fetching the nonce with eth_getTransactionCount at "latest" is a common way to land on an already-used nonce, since the stuck transaction is pending, not mined.
Practical fix — replace the stuck transaction rather than appending a new one, and bid meaningfully above it:
cast send --resend --priority-gas-price <higher tip> ...Look up the current priority fee for the chain first (chain explorers publish it) and add headroom; on Polygon in particular, the network's floor tip is high enough that a default estimate is frequently under it.
Other causes that produce the same message, worth checking before you keep escalating the tip: your transaction would revert, so builders deprioritise it and it sits pending (simulate with cast call first); the RPC endpoint is behind a load balancer whose nodes disagree about your pending set (try a different provider); or a previous script run left an unmined transaction you have forgotten about (cast nonce --block pending <addr> versus cast nonce <addr> shows the gap).
The wrong guess is raising --gas-limit, which has no effect on replacement pricing.
Source: adapted from a Stack Exchange answer by Mikko Ohtamaa (question by Mikko Ohtamaa), https://ethereum.stackexchange.com/questions/161808/foundtry-cast-code-32000-message-replacement-transaction-underpriced-data — CC BY-SA 4.0