'NearProtocol transaction commit, how to avoid InvalidNonce error reponce

In same cases, there is an error on transaction commit like

{"code"=>-32000,
     "data"=>{"TxExecutionError"=>{"InvalidTxError"=>{"InvalidNonce"=>{"ak_nonce"=>58108599002462, "tx_nonce"=>58108599002462}}}},
     "name"=>"HANDLER_ERROR",

In the error response, the ak_nonce is equal to tx_nonce The question what is wrong with nonce ? How do avoid this error?

Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source