InconsistentKeys error being returned where DuplicateKeys is expected
See original GitHub issueCreating this issue as requested in forum thread: https://discuss.daml.com/t/2481/
When repeatedly exercising a choice with the below logic, an InconsistentKeys
error is returned by the ledger API, whereas it seems like the correct error would be DuplicateKeys
.
Please note, repeated commands are sent with a delay to ensure there is no race. There are no concurrent transactions when this error is produced.
template Vendor
with
networkOwner: Party
vendor: Party
vendorId: Text
where
signatory networkOwner
observer vendor
key (networkOwner, vendorId): (Party, Text)
maintainer key._1
controller networkOwner can
nonconsuming RegisterProduct: (Optional (ContractId Client), ContractId Product)
with productInfo: ProductInformation; clientInfo: ClientInformation
do
clientCid <- lookupByKey @Client (clientKey)
productCid <- lookupByKey @Product (productKey)
newClient <- case clientCid of
None -> do
exerciseByKey @ClientList (clientListKey) AddClients with newClients = [clientInfo]
case clientInfo.clientType of
FIRSTTYPE -> do
newClient <- create Client with ...
return (Some newClient)
SECONDTYPE -> do return None
Some clientCid -> do
client <- fetch clientCid
archive clientCid
newClient <- create client with products = dedup (productInfo :: client.products)
return (Some newClient)
product <- create Product with ...
return (newClient, product)
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
check-db returns duplicate key error on a unique index ...
Tried to locate the duplicate rows, however select query returns only 1 value. I have absolutely no idea now. What could be the...
Read more >I'm seeing a duplicate keys error, what does that mean?
Sometimes, the error message will be shown as “A duplicate key was detected (). Please check your data provider configuration and try again.“....
Read more >3 common foreign key mistakes (and how to avoid them)
Dangling foreign keys 3. Not creating foreign key indexes Bonus: Not using foreign keys Key takeaway: think before you CREATE TABLE.
Read more >Db2 11 - Messages - DSNU340I - IBM
Use the REPAIR utility with LOCATE RID and DUMP statements to view the records with duplicate keys. The inconsistent index can cause SQLSELECT...
Read more >Find and fix inconsistent B-tree indexes - PostgreSQL
Inconsistencies in database indexes can occur for a variety of reasons ... The statement returns the duplicate keys and a count of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @cocreature apologies for the delayed reply. Yes, this seems resolved now. Thanks for following up!
Hi @LAshenhurst, have you been able to verify that this fixes your issue? On our side, we are unable to reproduce this issue with the fix in 1.13.0 or anything later.