WriteError

Python (PyMongo)OperationFailurewrite

Base class for errors from individual write operations (inserts, updates, deletes)

Related Jira Issues

GODRIVER-4172Backlog
Maintain the error chain when returning a mongo.WriteException
h3. *Context* The [{{processWriteError}}|https://github.com/mongodb/mongo-go-driver/blob/3f2f028ee04bcb9e287ab4e23181873c540ec736/mongo/errors.go#L907] func converts all errors chains that contain type {{driver.WriteCommandError}} into a {{mongo.WriteException}}, but discards the error chain. As a result, the additional context from all wrapped and joined errors is completely missing from the returned error. That means that joined retry errors (added with GODRIVER-3600) are never returned from
JAVA-6071Closed
Test failures due to connection leaks and unexpected exceptions in bulk write tests
During the execution of CrudProseTest.testBulkWriteHandlesWriteErrorsAcrossBatches, the test fails with an unexpected *IllegalStateException* (timeout during blocking read) instead of the expected {*}ClientBulkWriteException{*}. Additionally, an assertion error occurs because not all connections are closed after shutting down the client, and a *NullPointerException* is thrown in asynchronous channel handling.  *Evidence from logs: [Link|https://parsley.corp.mongodb.com/test/mongo_java_driver_
JAVA-6087In Code Review
RetryableWriteError label not preserved for retryable writeConcernError
In MixedBulkWriteOperation, when we decide to attach RetryableWriteError for a retryable write concern failure (e.g., last-attempt path), the label is currently written to the {*}writeConcernErro{*}r subdocument. However, when building MongoBulkWriteException, BulkWriteBatch.getBulkWriteException() reads labels from the top-level {*}result.errorLabels{*}. Labels added under *writeConcernError* are not parsed, so they are lost. *Impact* Applications checking e.hasErrorLabel("RetryableWriteErr
GODRIVER-4204Backlog
Preserve the error chain from InsertMany, BulkWrite, and ClientBulkWrite
h3. *Context* GODRIVER-4172 makes {{mongo.WriteException}} a wrapper: {{processWriteError}} now wraps the error chain it was handed instead of replacing it. However, {{InsertMany}}, {{BulkWrite}} and {{ClientBulkWrite}} build their own error values, either never calling {{processWriteError}}, or calling it and then copying fields out of the returned {{WriteException}} into a fresh exception value, discarding the chain. Note that {{bulkWrite.execute}} and {{clientBulkWrite.execute}} are in
GODRIVER-3602Backlog
Unify the error handling paradigms for Go Driver APIs
h3. *Context* Errors returned by Go Driver APIs are difficult to handle. Users have to know what error types to check for and/or what error helper functions to use (e.g. {{mongo.IsTimeout}}). Many errors lose context as they're returned through the layers of logic, meaning the error messages don't describe what actually happened. Additionally, error messaging in the Go Driver has historically been difficult and error-prone because of functions like {{replaceErrors}} and {{processWriteError}}
GODRIVER-4096Closed
Collection.InsertMany can panic on multiple write errors
### Summary   `Collection.InsertMany` (via `Collection.insert`) can panic with `runtime error: slice bounds out of range [:-1]` when using unordered inserts (`SetOrdered(false)`) if 2 or more documents fail and the server's returned `WriteErrors` are not sorted in ascending order by `Index`.   ### Where   `mongo/collection.go`, inside `Collection.insert`'s post-processing of a `driver.WriteCommandError`:   ```go for i, we := range wce.WriteErrors {     // i indexes have been removed be
NODE-4068Backlog
Return null when indicating absence of an object
From the ECMAScript2015 spec {quote}4.3.10 undefined value primitive value used when a variable has not been assigned a value 4.3.12 null value primitive value that represents the intentional absence of any object value {quote} h3. AC * Audit usage of | undefined in return types, a function that "returns undefined" should actually be void. * If the API is supposed to return something or nothing it should always use null to indicate "nothing", ex. {{getWriteErrorAt}} * Investigat
PYTHON-4987Closed
test.test_transactions_unified.TestUnifiedErrorLabelsBlockConnection.test_add_RetryableWriteError_and_UnknownTransactionCommitResult_labels_to_connection_errors
h3. *Name of Failure:* test.test_transactions_unified.TestUnifiedErrorLabelsBlockConnection.test_add_RetryableWriteError_and_UnknownTransactionCommitResult_labels_to_connection_errors h3. *Link to task:* [https://spruce.mongodb.com/task/mongo_python_driver_test_macos_python3.13_test_8.0_replica_set_noauth_ssl_sync_1c7a7fe9ec3119228bc7bf98f1f9de199a4f8f2c_24_11_20_19_47_28/tests?execution=0&sortBy=STATUS&sortDir=ASC] h3. *Context of when and why the failure occurred:* [FAILURE: pymongo