<p>I'm trying to sync data from Cardano using cardano-db-sync <a href="https://github.com/input-output-hk/cardano-db-sync" rel="nofollow noreferrer">https://github.com/input-output-hk/cardano-db-sync</a>, but the insertion process is stuck at epoch 323 due to the following error.</p>
<p>logs from cardano-db-sync container.</p>
<pre><code>2023-09-05 11:46:20 [db-sync-node:Info:69] [2023-09-05 04:46:20.06 UTC] Setting ConsistencyLevel to Unchecked
2023-09-05 11:46:20 [db-sync-node:Info:69] [2023-09-05 04:46:20.06 UTC] Starting chainSyncClient
2023-09-05 11:46:20 [db-sync-node:Info:69] [2023-09-05 04:46:20.07 UTC] Suggesting intersection points from memory: [] and from disk: [At (Block {blockPointSlot = SlotNo 54172778, blockPointHash = cdf1659a3479ff45a5a82119992dce030df5dd8b0b1c77b40ba4fb64a22dfd57}),At (Block {blockPointSlot = SlotNo 53740772, blockPointHash = 87c4a226c0be561fc4046c6eb6329b83358aad467ed5ccdd8b606cbdb21c46c0}),At (Block {blockPointSlot = SlotNo 53308780, blockPointHash = 8ea9407d84e0dad7eb281d41a84a292d538575583548e1237db29af677bc9b23}),At (Block {blockPointSlot = SlotNo 52876752, blockPointHash = af192981f47a4150b4d4f96e2184050699febbbc31de18c3815bb5f338578ff6}),At (Block {blockPointSlot = SlotNo 52444775, blockPointHash = f041cf4833a057855654977df9fbe4f90f65b38c5403cad3d8b61d6015aa40db}),At (Block {blockPointSlot = SlotNo 52012780, blockPointHash = 1cef8acffe72da132b404da7d3e207e93fbbc6cb21f190bffe0969022e18dd98})]
2023-09-05 11:46:20 [db-sync-node.Subscription:Notice:54] [2023-09-05 04:46:20.07 UTC] Identity Required subscriptions started
2023-09-05 11:46:20 [db-sync-node:Info:69] [2023-09-05 04:46:20.08 UTC] Cardano.Db tip is at slot 54189281, block 6924046
2023-09-05 11:46:20 [db-sync-node:Info:75] [2023-09-05 04:46:20.08 UTC] Running DB thread
2023-09-05 11:46:20 [db-sync-node:Info:76] [2023-09-05 04:46:20.08 UTC] Running Offline fetch thread
2023-09-05 11:46:20 [db-sync-node:Info:75] [2023-09-05 04:46:20.10 UTC] Delaying delete of 761 blocks after Just 6923285 while rolling back to (slot 54172778, hash cdf1659a3479ff45a5a82119992dce030df5dd8b0b1c77b40ba4fb64a22dfd57). Applying blocks until a new block is found. The node is currently at Tip (SlotNo 85337653) dc36cb4b276a4647efa8e53b6e86a93cef0c4964d12b8f90c3d9cc0e7228c684 (BlockNo 8423610)
2023-09-05 11:49:45 [db-sync-node:Info:75] [2023-09-05 04:49:45.52 UTC] Found snapshot file for slot 54172778, hash cdf1659a3479ff45a5a82119992dce030df5dd8b0b1c77b40ba4fb64a22dfd57. It took 2.359985918s to read from disk and 203.053995538s to parse.
2023-09-05 11:49:48 [db-sync-node:Info:75] [2023-09-05 04:49:48.04 UTC] Found snapshot file for slot 54172778, hash cdf1659a3479ff45a5a82119992dce030df5dd8b0b1c77b40ba4fb64a22dfd57
2023-09-05 11:49:48 [db-sync-node:Info:75] [2023-09-05 04:49:48.05 UTC] Setting ConsistencyLevel to DBAheadOfLedger
2023-09-05 11:50:16 [db-sync-node:Info:75] [2023-09-05 04:50:16.92 UTC] File /var/lib/cexplorer/54172778-cdf1659a34-322.lstate exists
2023-09-05 11:50:19 [db-sync-node:Info:75] [2023-09-05 04:50:19.60 UTC] Reached EpochNo 323
2023-09-05 11:50:31 [db-sync-node:Info:75] [2023-09-05 04:50:31.79 UTC] Received block which is not in the db with HeaderFields {headerFieldSlot = SlotNo 54189303, headerFieldBlockNo = BlockNo 6924047, headerFieldHash = 5ebbb8ce01d25918903b804b003094545a7111d8763e71ff0c14c33898358bd0}. Time to restore consistency.
2023-09-05 11:50:31 [db-sync-node:Info:75] [2023-09-05 04:50:31.80 UTC] Starting at epoch 323
2023-09-05 11:50:32 [db-sync-node:Info:75] [2023-09-05 04:50:32.84 UTC] Insert Alonzo Block: epoch 323, slot 54189303, block 6924047, hash 5ebbb8ce01d25918903b804b003094545a7111d8763e71ff0c14c33898358bd0
2023-09-05 11:50:33 [db-sync-node:Info:75] [2023-09-05 04:50:33.11 UTC] Setting ConsistencyLevel to Consistent
2023-09-05 11:50:33 [db-sync-node:Error:75] [2023-09-05 04:50:33.26 UTC] Error: resolveTxInputs TxIn {txInHash = &quot;\140+&lt;\254\229\168\\ \234\156\246\216\251\208\&amp;1\193X\203\130\249\DLE\242\226\219\f\GS\148\NUL\184\EM\137\223&quot;, txInIndex = 0, txInRedeemerIndex = Nothing}  tx hash 8c2b3cfee5a85c20ea9cf6d8fbd031c158cb82f910f2e2db0c1d9400b81989df
2023-09-05 11:50:33 [db-sync-node:Info:75] [2023-09-05 04:50:33.26 UTC] Shutting down DB thread
</code></pre>
<p>Could anyone help to fix it, please?
Thank you</p>

CC BY-SA 4.0
2023-09-05T06:03:09.690Z
Is this mainnet?

Your issue is at epoch 323 which is from over a year ago. Are you trying to sync from scratch? If so, why, we provide snapshots which only take hours to install.
Erik de Castro Lopo
CC BY-SA 4.0
2023-09-05T06:21:33.797Z
yes, this is mainnet, I'm following the guide https://github.com/input-output-hk/cardano-db-sync and just run docker-compose up. The sync process is from epoch 0. Could you share where the snapshots are? and will they contain all the history tx of wallets?
manhdt
CC BY-SA 4.0
2023-09-05T06:46:22.447Z
The snapshots are linked from the Github releases page and the docker compose file allows the specification of a snapshot. Sorry, can't help more than that because I do not know much about docker.
Erik de Castro Lopo
CC BY-SA 4.0
2023-09-30T01:51:00.073Z
Thank you. I found the document here https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/state-snapshot.md. it's very useful
manhdt
<cardano-db-sync>
Cardano-db-sync insertion error
# Cardano-db-sync insertion error

(Asked by: username_0 on 2023-09-05)

I'm trying to sync data from Cardano using cardano-db-sync https://github.com/input-output-hk/cardano-db-sync, but the insertion process is stuck at epoch 323 due to the following error.
logs from cardano-db-sync container.
2023-09-05 11:46:20 [db-sync-node:Info:69] [2023-09-05 04:46:20.06 UTC] Setting ConsistencyLevel to Unchecked
2023-09-05 11:46:20 [db-sync-node:Info:69] [2023-09-05 04:46:20.06 UTC] Starting chainSyncClient
2023-09-05 11:46:20 [db-sync-node:Info:69] [2023-09-05 04:46:20.07 UTC] Suggesting intersection points from memory: [] and from disk: [At (Block {blockPointSlot = SlotNo 54172778, blockPointHash = cdf1659a3479ff45a5a82119992dce030df5dd8b0b1c77b40ba4fb64a22dfd57}),At (Block {blockPointSlot = SlotNo 53740772, blockPointHash = 87c4a226c0be561fc4046c6eb6329b83358aad467ed5ccdd8b606cbdb21c46c0}),At (Block {blockPointSlot = SlotNo 53308780, blockPointHash = 8ea9407d84e0dad7eb281d41a84a292d538575583548e1237db29af677bc9b23}),At (Block {blockPointSlot = SlotNo 52876752, blockPointHash = af192981f47a4150b4d4f96e2184050699febbbc31de18c3815bb5f338578ff6}),At (Block {blockPointSlot = SlotNo 52444775, blockPointHash = f041cf4833a057855654977df9fbe4f90f65b38c5403cad3d8b61d6015aa40db}),At (Block {blockPointSlot = SlotNo 52012780, blockPointHash = 1cef8acffe72da132b404da7d3e207e93fbbc6cb21f190bffe0969022e18dd98})]
2023-09-05 11:46:20 [db-sync-node.Subscription:Notice:54] [2023-09-05 04:46:20.07 UTC] Identity Required subscriptions started
2023-09-05 11:46:20 [db-sync-node:Info:69] [2023-09-05 04:46:20.08 UTC] Cardano.Db tip is at slot 54189281, block 6924046
2023-09-05 11:46:20 [db-sync-node:Info:75] [2023-09-05 04:46:20.08 UTC] Running DB thread
2023-09-05 11:46:20 [db-sync-node:Info:76] [2023-09-05 04:46:20.08 UTC] Running Offline fetch thread
2023-09-05 11:46:20 [db-sync-node:Info:75] [2023-09-05 04:46:20.10 UTC] Delaying delete of 761 blocks after Just 6923285 while rolling back to (slot 54172778, hash cdf1659a3479ff45a5a82119992dce030df5dd8b0b1c77b40ba4fb64a22dfd57). Applying blocks until a new block is found. The node is currently at Tip (SlotNo 85337653) dc36cb4b276a4647efa8e53b6e86a93cef0c4964d12b8f90c3d9cc0e7228c684 (BlockNo 8423610)
2023-09-05 11:49:45 [db-sync-node:Info:75] [2023-09-05 04:49:45.52 UTC] Found snapshot file for slot 54172778, hash cdf1659a3479ff45a5a82119992dce030df5dd8b0b1c77b40ba4fb64a22dfd57. It took 2.359985918s to read from disk and 203.053995538s to parse.
2023-09-05 11:49:48 [db-sync-node:Info:75] [2023-09-05 04:49:48.04 UTC] Found snapshot file for slot 54172778, hash cdf1659a3479ff45a5a82119992dce030df5dd8b0b1c77b40ba4fb64a22dfd57
2023-09-05 11:49:48 [db-sync-node:Info:75] [2023-09-05 04:49:48.05 UTC] Setting ConsistencyLevel to DBAheadOfLedger
2023-09-05 11:50:16 [db-sync-node:Info:75] [2023-09-05 04:50:16.92 UTC] File /var/lib/cexplorer/54172778-cdf1659a34-322.lstate exists
2023-09-05 11:50:19 [db-sync-node:Info:75] [2023-09-05 04:50:19.60 UTC] Reached EpochNo 323
2023-09-05 11:50:31 [db-sync-node:Info:75] [2023-09-05 04:50:31.79 UTC] Received block which is not in the db with HeaderFields {headerFieldSlot = SlotNo 54189303, headerFieldBlockNo = BlockNo 6924047, headerFieldHash = 5ebbb8ce01d25918903b804b003094545a7111d8763e71ff0c14c33898358bd0}. Time to restore consistency.
2023-09-05 11:50:31 [db-sync-node:Info:75] [2023-09-05 04:50:31.80 UTC] Starting at epoch 323
2023-09-05 11:50:32 [db-sync-node:Info:75] [2023-09-05 04:50:32.84 UTC] Insert Alonzo Block: epoch 323, slot 54189303, block 6924047, hash 5ebbb8ce01d25918903b804b003094545a7111d8763e71ff0c14c33898358bd0
2023-09-05 11:50:33 [db-sync-node:Info:75] [2023-09-05 04:50:33.11 UTC] Setting ConsistencyLevel to Consistent
2023-09-05 11:50:33 [db-sync-node:Error:75] [2023-09-05 04:50:33.26 UTC] Error: resolveTxInputs TxIn {txInHash = "\140+<\254\229\168\\ \234\156\246\216\251\208\&1\193X\203\130\249\DLE\242\226\219\f\GS\148\NUL\184\EM\137\223", txInIndex = 0, txInRedeemerIndex = Nothing}  tx hash 8c2b3cfee5a85c20ea9cf6d8fbd031c158cb82f910f2e2db0c1d9400b81989df
2023-09-05 11:50:33 [db-sync-node:Info:75] [2023-09-05 04:50:33.26 UTC] Shutting down DB thread

Could anyone help to fix it, please?
Thank you

**Tags:** cardano-db-sync
> **Comments:**
> **username_1**: Is this mainnet?  Your issue is at epoch 323 which is from over a year ago. Are you trying to sync from scratch? If so, why, we provide snapshots which only take hours to install.  
> **username_0**: yes, this is mainnet, I'm following the guide https://github.com/input-output-hk/cardano-db-sync and just run docker-compose up. The sync process is from epoch 0. Could you share where the snapshots are? and will they contain all the history tx of wallets?  
> **username_1**: The snapshots are linked from the Github releases page and the docker compose file allows the specification of a snapshot. Sorry, can't help more than that because I do not know much about docker.  
> **username_0**: Thank you. I found the document here https://github.com/input-output-hk/cardano-db-sync/blob/master/doc/state-snapshot.md. it's very useful  

---

## 0 answers

