<!-- llms-explorer concept facts · https://llms-explorer.com/tree/error-code-hierarchy-assertion-types/ · pack 2026-10-15 · ~1762 tokens -->

# Error Code Hierarchy & Assertion Types

> Depth-first rabbithole dossier for Error Code Hierarchy & Assertion Types; source-anchored research pack.

Parent: [KB-Backed Troubleshooting](https://llms-explorer.com/tree/kb-backed-troubleshooting/) · 4 facets · 14 facts · page: https://llms-explorer.com/tree/error-code-hierarchy-assertion-types/

## How it works

- [low] User-generated errors, such as out of disk space or duplicate key, are tracked by assertion counters where non-zero values indicate uncommon assertion errors that are not an immediate cause for concern. Sources: https://www.mongodb.com/docs/manual/reference/command/serverStatus.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#troubleshooting`
- [low] The fassert assertion type terminates the entire process for low-level checks where continuing might lead to corrupt data, while tassert fails the operation and triggers a "deferred-fatality tripwire flag". Sources: https://raw.githubusercontent.com/mongodb/mongo/master/docs/exception_architecture.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#core`
- [low] MongoDB logs ProtocolError (code 17) with messages like "recv(): message msgLen is invalid" when message lengths exceed the maximum of 16384 bytes, such as in cases with msgLen 290271 or 2111419. Sources: https://jira.mongodb.org/browse/SERVER-118428 — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#troubleshooting`

## Problems, failure modes and limitations

- [low] MongoDB returns specific error codes when an error occurs, including deprecated codes such as StaleShardVersion (6.0+), NoShardingEnabled (6.0+), FreeMonHttpInFlight (7.1+), FreeMonHttpTemporaryFailure (7.1+), FreeMonHttpPermanentFailure (7.1+), ShardInvalidatedForTargeting (7.1+), ChangeStreamTopologyChange (8.3+), and ChangeStreamNotEnabled (8.3+). (verified as of 2026-10-15) Sources: https://www.mongodb.com/docs/manual/reference/error-codes.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#core`
- [low] The massert assertion type logs the message as an error, whereas uassert logs at debug level 1, and iassert logs at debug level 3 without incrementing user assertion counters. Sources: https://raw.githubusercontent.com/mongodb/mongo/master/docs/exception_architecture.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#core`
- [low] MongoDB error codes 4000-8999 are reserved, and codes 65000-70999 are reserved for extension-developed logs and errors, which should not be used unless writing an extension. Sources: https://raw.githubusercontent.com/mongodb/mongo/master/src/mongo/base/error_codes.yml — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#core`
- [low] Specific MongoDB error codes include one for KMIP server requests that could succeed on retry, one for defensive BSON checks inside BSONObj and BSONElement, and one for lazy initialization of config.placementHistory. Sources: https://raw.githubusercontent.com/mongodb/mongo/master/src/mongo/base/error_codes.yml — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#core`
- [low] A specific MongoDB error code must never be used outside of cluster user management commands. Sources: https://raw.githubusercontent.com/mongodb/mongo/master/src/mongo/base/error_codes.yml — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#core`
- [low] The total number of operations that returned the WriteConflictRetryLimitExceeded error after exceeding the adaptive write conflict retry limit is tracked as a counter. Sources: https://www.mongodb.com/docs/manual/reference/command/serverStatus.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#core`
- [low] Error 6 (HostUnreachable) is undocumented and can denote indeterminate failures, such as "unable to initialize targeter for write op... Connection refused". Sources: https://jepsen.io/analyses/mongodb-4.2.6 — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#troubleshooting`

## Comparisons and alternatives

- [low] Failed operation-fatal assertions throw an AssertionException or a child class, and Noexcept is a runtime check that terminates the process rather than allowing a function to exit via throw. Sources: https://raw.githubusercontent.com/mongodb/mongo/master/docs/exception_architecture.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#core`

## Facts and statements

- [high] MongoDB assertion counters roll over to zero after 2^30 assertions, resetting all counters and incrementing the "rollovers" counter; the Datadog metric mongodb.asserts.rolloversps tracks this rate. Sources: https://www.mongodb.com/docs/manual/reference/command/serverStatus.md, https://raw.githubusercontent.com/mongodb/mongo/master/docs/exception_architecture.md, https://docs.datadoghq.com/integrations/mongo/ — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#core`
- [low] The convention for unique assertion location numbers is to use the 5 or 6 digit SERVER ticket number followed by a two-digit counter, with uniqueness verified at compile time by a Python script. Sources: https://raw.githubusercontent.com/mongodb/mongo/master/docs/exception_architecture.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#methodology`
- [high] Never use kill -9 (SIGKILL) to terminate a mongod instance. Separately, throwing exceptions in destructors or letting them leak out of noexcept code can crash the server and compromise availability. Sources: https://www.mongodb.com/docs/manual/tutorial/manage-mongodb-processes.md, https://raw.githubusercontent.com/mongodb/mongo/master/docs/exception_architecture.md — source: `~/.global-ai-hub/research/.pipeline/mongodb-2026-10-14/frb/error-code-hierarchy-assertion-types-cc26a40831/rabbithole-synthesis.md#antipatterns`

## Related concepts

- Error — is a part of Error Code Hierarchy & Assertion Types
- Code — is a part of Error Code Hierarchy & Assertion Types
- Assertion — is a part of Error Code Hierarchy & Assertion Types
