Where can i find a list of errors and error codes that the mongo server throws

8,964 views
Skip to first unread message

Adil

unread,
Oct 10, 2014, 9:53:24 AM10/10/14
to mongod...@googlegroups.com
I'm trying to catch some specific Exceptions (like : "duplicate key insert for unique index of capped collection") that the server sends and ignore them. Instead of text matching, i'd like to match by error code. Is there a list somewhere that i can use as reference? I could not find anything other than this : https://github.com/mongodb/mongo/blob/master/docs/errors.md . It doesn't contain the error above.

Thanks,
Adil

Stephen Steneker

unread,
Oct 11, 2014, 7:28:03 AM10/11/14
to mongod...@googlegroups.com
On Saturday, 11 October 2014 00:53:24 UTC+11, Adil wrote:
I'm trying to catch some specific Exceptions (like : "duplicate key insert for unique index of capped collection") that the server sends and ignore them. Instead of text matching, i'd like to match by error code. Is there a list somewhere that i can use as reference? I could not find anything other than this : https://github.com/mongodb/mongo/blob/master/docs/errors.md . It doesn't contain the error above.

Hi Adil,

The errors.md document is generated by parsing the source code for assertions (see buildscripts/errorcodes.py). The error.md list in github may not be complete and will vary by version of MongoDB. For example, error.md will not include new assertions that have been added since the checked-in doc was generated, or previous assertions that have been removed due to code refactoring.

The "master" branch you referenced relates to the current development cycle (MongoDB 2.7.x), so you should instead be looking at a branch relevant for your version of MongoDB.

The exception you asked about ("duplicate key insert for unique index of capped collection") does not appear in the current code base, so is also missing from errors.md in the master branch. In MongoDB 2.6, duplicate key exceptions on capped collections now return E11000 (the same as a duplicate key exception on a non-capped collection). 

Given the exception you're trying to catch, I assume you are using MongoDB 2.4 or older: https://github.com/mongodb/mongo/blob/v2.4/docs/errors.md.

Regards,
Stephen

Adil Baig

unread,
Oct 11, 2014, 11:33:24 AM10/11/14
to mongodb-user
Hey Stephen,

Thank you for the comprehensive response.

Adil

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/cKV3rJVRfqE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/5d7b690d-ce68-4118-85e0-6fe7e058503b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thangavel Loganathan

unread,
Feb 7, 2017, 3:41:52 PM2/7/17
to mongodb-user
Hi Stephen,

         Could you please send me the link for 3.4 error codes? I couldn't find it. :-( 

Thanks in advance! Cheers!!

Regards,
Thangavel L

Stephen Steneker

unread,
Feb 8, 2017, 7:08:58 AM2/8/17
to mongodb-user
On Wednesday, 8 February 2017 07:41:52 UTC+11, Thangavel Loganathan wrote:
 Could you please send me the link for 3.4 error codes? I couldn't find it. :-( 

Hi Thangavel,

There is no equivalent link for MongoDB 3.4. The previous "errors.md" file was an internal (and incomplete) reference generated from the server source code, and was not updated in sync with the code base. This file was finally removed during the 3.3 development cycle, but an updated version hadn't been committed for several years prior. The last committed version predated MongoDB 3.0.

In general your MongoDB driver should roll up any errors into relevant exception categories for your application to handle. For example: MongoDB .NET Driver: Error Handling

If you have questions about specific error codes or error handling, please start a new discussion including details of your server and driver versions as well as the use case.

Regards,
Stennie

Gustavo Schenkel

unread,
Feb 23, 2017, 10:00:16 PM2/23/17
to mongodb-user
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages