couchbaselabs / couchbaselabs/couchbase-shell

query transactions "COMMIT WORK;" results in "Failed post commit", code: 17018

Open
#615 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
87
Forks
18
PR merge metrics
No merged PRs in 30d

Description

Hi everyone!

I'm running a nushell script through `cbsh` to update data in multiple collections at once with a transaction. It works perfectly fine in our development database, but for some reason fails in the production with the following error:

```
[INFO] 2025-05-30 13:00:55.764 Ending transaction
Error: × Unknown query error
╭─[.nu:37:5]
36 │
37 │ query transactions "COMMIT WORK;"
· ─────────┬────────
· ╰──
38 │ }
╰────
help: Received error from query engine, message: "Failed post commit", code: 17018
```

It looks very much like [`TransactionCommitAmbiguousException`](https://docs.couchbase.com/java-sdk/current/concept-docs/transactions-error-handling.html#transaction_errors), because the changes are actually applied, though it might take some time as for larger data to get updated (replication?) – I keep getting old results from the repl / Query Workbench.

The script looks like this:

```nushell
query transactions "BEGIN WORK;"

for collection in $collections {
let update_query = $"UPDATE ($collection) SET ... WHERE ... RETURNING META().id"
let result = query transactions $update_query
print $"Updated ($result | length) documents in ($collection)"
}

query transactions "COMMIT WORK;"
```

It seems like a bug, but I'm not sure that this repo is the right place to refer to. Any help or directions are appreciated 🙏

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.