Hi all,
I am using a script to tranform notes from another software to the Logseq JSON format. The script was built using according to the structure from Logseq JSON export.
I am now facing weird issues with some block references that create the following error while importing to Logseq:
Error happens when creating block content of page Balbaa2021 Problemseite
#error {:message "Conflicting upsert: [:block/uuid #uuid \"8d8194c5-573e-4b5f-948c-8fee1b0ac6c1\"] resolves to 30, but entity already has :db/id 34", :data {:error :transact/upsert, :assertion [30 :block/uuid #uuid "8d8194c5-573e-4b5f-948c-8fee1b0ac6c1"], :conflict {:db/id 34}}}
Skipped and continue the remaining import.
The concerning page wont be created after import and all references to the affected block are broken.
I created a minimal example to recreate the behavior. This JSON file is produced by the script and contains a block at the page āBalbaa2021 Problemseiteā that is referenced on the page ā2. Testseiteā:
{"blocks":[{"page-name":"Balbaa2021 Problemseite","children":[{"children":[],"format":"markdown","id":"8d8194c5-573e-4b5f-948c-8fee1b0ac6c1","properties":null,"content":"Problemblock"}],"id":"06db2c30-3c8b-402e-90e5-953590679ede","properties":null},{"page-name":"2. Testseite","children":[{"children":[],"format":"markdown","id":"5cf0273d-96eb-42bc-b416-352acd45b0ad","properties":null,"content":"Test 2\n((8d8194c5-573e-4b5f-948c-8fee1b0ac6c1))"},{"children":[],"format":"markdown","id":"eef88db2-f3d3-47dd-89af-721dcadfaac0","properties":null,"content":""}],"id":"69846701-e59c-482d-b50b-498f171212d6","properties":null}],"version":1}
This JSON file is created by an Logseq export an contains the same. It shows the same error when reimporting to a new Logseq Graph, although the reference worked correctly in Logseq before the export:
{"version":1,"blocks":[{"id":"6688efc8-7e2c-4c45-b6b4-cdd1411ecce2","page-name":"Contents","properties":null,"children":[{"id":"6688efc8-f4a1-4209-9462-4139e973fec5","properties":null,"format":"markdown","children":[],"content":""}]},{"id":"6688efc8-6ae4-4cdd-be01-89574f8d1bb3","page-name":"2. Testseite","properties":null,"children":[{"id":"6688efc8-6c3f-491e-8ad0-d25eb2f63d70","properties":null,"format":"markdown","children":[],"content":"Test 2\n((6688efad-d9a7-4312-a27c-e4ca23853364))"}]},{"id":"6688efc8-8ad3-467f-927a-f102cc7bfac7","page-name":"Balbaa2021","properties":null,"children":[{"id":"6688efad-d9a7-4312-a27c-e4ca23853364","properties":{},"format":"markdown","children":[],"content":"Problemblock"}]}]}
It does not happen to all block references in a larger file. But, I could not yet figure out why a reference is affected.
Do you have any idea how to avoid this errors and create working block references from JSON import?
Thanks a lot.
Gregor93