MongoDB will return one of the following codes when an error occurs. Use this
guide to interpret logs and when troubleshooting
issues with mongod and mongos instances.
| Code | Cause | 
|---|---|
| InternalError | |
| BadValue | |
| NoSuchKey | |
| GraphContainsCycle | |
| HostUnreachable | |
| HostNotFound | |
| UnknownError | |
| FailedToParse | |
| CannotMutateObject | |
| UserNotFound | |
| UnsupportedFormat | |
| Unauthorized | |
| TypeMismatch | |
| Overflow | |
| InvalidLength | |
| ProtocolError | |
| AuthenticationFailed | |
| CannotReuseObject | |
| IllegalOperation | |
| EmptyArrayOperation | |
| InvalidBSON | |
| AlreadyInitialized | |
| LockTimeout | |
| RemoteValidationError | |
| NamespaceNotFound | |
| IndexNotFound | |
| PathNotViable | |
| NonExistentPath | |
| InvalidPath | |
| RoleNotFound | |
| RolesNotRelated | |
| PrivilegeNotFound | |
| CannotBackfillArray | |
| UserModificationFailed | |
| RemoteChangeDetected | |
| FileRenameFailed | |
| FileNotOpen | |
| FileStreamFailed | |
| ConflictingUpdateOperators | |
| FileAlreadyOpen | |
| LogWriteFailed | |
| CursorNotFound | |
| UserDataInconsistent | |
| LockBusy | |
| NoMatchingDocument | |
| NamespaceExists | |
| InvalidRoleModification | |
| MaxTimeMSExpired | |
| ManualInterventionRequired | |
| DollarPrefixedFieldName | |
| InvalidIdField | |
| NotSingleValueField | |
| InvalidDBRef | |
| EmptyFieldName | |
| DottedFieldName | |
| RoleModificationFailed | |
| CommandNotFound | |
| ShardKeyNotFound | |
| OplogOperationUnsupported | |
| StaleShardVersion | |
| WriteConcernFailed | |
| MultipleErrorsOccurred | |
| ImmutableField | |
| CannotCreateIndex | |
| IndexAlreadyExists | |
| AuthSchemaIncompatible | |
| ShardNotFound | |
| ReplicaSetNotFound | |
| InvalidOptions | |
| InvalidNamespace | |
| NodeNotFound | |
| WriteConcernLegacyOK | |
| NoReplicationEnabled | |
| OperationIncomplete | |
| CommandResultSchemaViolation | |
| UnknownReplWriteConcern | |
| RoleDataInconsistent | |
| NoMatchParseContext | |
| NoProgressMade | |
| RemoteResultsUnavailable | |
| IndexOptionsConflict | |
| IndexKeySpecsConflict | |
| CannotSplit | |
| NetworkTimeout | |
| CallbackCanceled | |
| ShutdownInProgress | |
| SecondaryAheadOfPrimary | |
| InvalidReplicaSetConfig | |
| NotYetInitialized | |
| NotSecondary | |
| OperationFailed | |
| NoProjectionFound | |
| DBPathInUse | |
| UnsatisfiableWriteConcern | |
| OutdatedClient | |
| IncompatibleAuditMetadata | |
| NewReplicaSetConfigurationIncompatible | |
| NodeNotElectable | |
| IncompatibleShardingMetadata | |
| DistributedClockSkewed | |
| LockFailed | |
| InconsistentReplicaSetNames | |
| ConfigurationInProgress | |
| CannotInitializeNodeWithData | |
| NotExactValueField | |
| WriteConflict | |
| InitialSyncFailure | |
| InitialSyncOplogSourceMissing | |
| CommandNotSupported | |
| DocTooLargeForCapped | |
| ConflictingOperationInProgress | |
| NamespaceNotSharded | |
| InvalidSyncSource | |
| OplogStartMissing | |
| DocumentValidationFailure (only for the document validator on collections) | |
| NotAReplicaSet | |
| IncompatibleElectionProtocol | |
| CommandFailed | |
| RPCProtocolNegotiationFailed | |
| UnrecoverableRollbackError | |
| LockNotFound | |
| LockStateChangeFailed | |
| SymbolNotFound | |
| FailedToSatisfyReadPreference | |
| ReadConcernMajorityNotAvailableYet | |
| StaleTerm | |
| CappedPositionLost | |
| IncompatibleShardingConfigVersion | |
| RemoteOplogStale | |
| JSInterpreterFailure | |
| InvalidSSLConfiguration | |
| SSLHandshakeFailed | |
| JSUncatchableError | |
| CursorInUse | |
| IncompatibleCatalogManager | |
| PooledConnectionsDropped | |
| ExceededMemoryLimit | |
| ZLibError | |
| ReadConcernMajorityNotEnabled | |
| NoConfigPrimary | |
| StaleEpoch | |
| OperationCannotBeBatched | |
| OplogOutOfOrder | |
| ChunkTooBig | |
| InconsistentShardIdentity | |
| CannotApplyOplogWhilePrimary | |
| CanRepairToDowngrade | |
| MustUpgrade | |
| DurationOverflow | |
| MaxStalenessOutOfRange | |
| IncompatibleCollationVersion | |
| CollectionIsEmpty | |
| ZoneStillInUse | |
| InitialSyncActive | |
| ViewDepthLimitExceeded | |
| CommandNotSupportedOnView | |
| OptionNotSupportedOnView | |
| InvalidPipelineOperator | |
| CommandOnShardedViewNotSupportedOnMongod | |
| TooManyMatchingDocuments | |
| CannotIndexParallelArrays | |
| TransportSessionClosed | |
| TransportSessionNotFound | |
| TransportSessionUnknown | |
| QueryPlanKilled | |
| FileOpenFailed | |
| ZoneNotFound | |
| RangeOverlapConflict | |
| WindowsPdhError | |
| BadPerfCounterPath | |
| AmbiguousIndexKeyPattern | |
| InvalidViewDefinition | |
| ClientMetadataMissingField | |
| ClientMetadataAppNameTooLarge | |
| ClientMetadataDocumentTooLarge | |
| ClientMetadataCannotBeMutated | |
| LinearizableReadConcernError | |
| IncompatibleServerVersion | |
| PrimarySteppedDown | |
| MasterSlaveConnectionFailure | |
| FailPointEnabled | |
| NoShardingEnabled | |
| BalancerInterrupted | |
| ViewPipelineMaxSizeExceeded | |
| InvalidIndexSpecificationOption | |
| ReplicaSetMonitorRemoved | |
| ChunkRangeCleanupPending | |
| CannotBuildIndexKeys | |
| NetworkInterfaceExceededTimeLimit | |
| ShardingStateNotInitialized | |
| TimeProofMismatch | |
| ClusterTimeFailsRateLimiter | |
| NoSuchSession | |
| InvalidUUID | |
| TooManyLocks | |
| StaleClusterTime | |
| CannotVerifyAndSignLogicalTime | |
| KeyNotFound | |
| IncompatibleRollbackAlgorithm | |
| DuplicateSession | |
| AuthenticationRestrictionUnmet | |
| DatabaseDropPending | |
| ElectionInProgress | |
| IncompleteTransactionHistory | |
| UpdateOperationFailed | |
| FTDCPathNotSet | |
| FTDCPathAlreadySet | |
| IndexModified | |
| CloseChangeStream | |
| IllegalOpMsgFlag | |
| QueryFeatureNotAllowed | |
| TransactionTooOld | |
| AtomicityFailure | |
| CannotImplicitlyCreateCollection | |
| SessionTransferIncomplete | |
| MustDowngrade | |
| DNSHostNotFound | |
| DNSProtocolError | |
| MaxSubPipelineDepthExceeded | |
| TooManyDocumentSequences | |
| RetryChangeStream | |
| InternalErrorNotSupported | |
| ForTestingErrorExtraInfo | |
| CursorKilled | |
| NotImplemented | |
| SnapshotTooOld | |
| DNSRecordTypeMismatch | |
| ConversionFailure | |
| CannotCreateCollection | |
| IncompatibleWithUpgradedServer | |
| BrokenPromise | |
| SnapshotUnavailable | |
| ProducerConsumerQueueBatchTooLarge | |
| ProducerConsumerQueueEndClosed | |
| StaleDbVersion | |
| StaleChunkHistory | |
| NoSuchTransaction | |
| ReentrancyNotAllowed | |
| FreeMonHttpInFlight | |
| FreeMonHttpTemporaryFailure | |
| FreeMonHttpPermanentFailure | |
| TransactionCommitted | |
| TransactionTooLarge | |
| UnknownFeatureCompatibilityVersion | |
| KeyedExecutorRetry | |
| InvalidResumeToken | |
| TooManyLogicalSessions | |
| ExceededTimeLimit | |
| OperationNotSupportedInTransaction | |
| TooManyFilesOpen | |
| OrphanedRangeCleanUpFailed | |
| FailPointSetFailed | |
| PreparedTransactionInProgress | |
| CannotBackup | |
| DataModifiedByRepair | |
| RepairedReplicaSetNode | |
| JSInterpreterFailureWithStack | |
| MigrationConflict | |
| ProducerConsumerQueueProducerQueueDepthExceeded | |
| ProducerConsumerQueueConsumed | |
| ExchangePassthrough | |
| IndexBuildAborted | |
| AlarmAlreadyFulfilled | |
| UnsatisfiableCommitQuorum | |
| ClientDisconnect | |
| ChangeStreamFatalError | |
| TransactionCoordinatorSteppingDown | |
| TransactionCoordinatorReachedAbortDecision | |
| WouldChangeOwningShard | |
| ForTestingErrorExtraInfoWithExtraInfoInNamespace | |
| IndexBuildAlreadyInProgress | |
| ChangeStreamHistoryLost | |
| TransactionCoordinatorDeadlineTaskCanceled | |
| ChecksumMismatch | |
| WaitForMajorityServiceEarlierOpTimeAvailable | |
| TransactionExceededLifetimeLimitSeconds | |
| NoQueryExecutionPlans | |
| QueryExceededMemoryLimitNoDiskUseAllowed | |
| InvalidSeedList | |
| InvalidTopologyType | |
| InvalidHeartBeatFrequency | |
| TopologySetNameRequired | |
| HierarchicalAcquisitionLevelViolation | |
| InvalidServerType | |
| OCSPCertificateStatusRevoked | |
| RangeDeletionAbandonedBecauseCollectionWithUUIDDoesNotExist | |
| DataCorruptionDetected | |
| OCSPCertificateStatusUnknown | |
| SplitHorizonChange | |
| ShardInvalidatedForTargeting | |
| RangeDeletionAbandonedBecauseTaskDocumentDoesNotExist | |
| CurrentConfigNotCommittedYet | |
| ExhaustCommandFinished | |
| PeriodicJobIsStopped | |
| TransactionCoordinatorCanceled | |
| OperationIsKilledAndDelisted | |
| ResumableRangeDeleterDisabled | |
| ObjectIsBusy | |
| TooStaleToSyncFromSource | |
| QueryTrialRunCompleted | |
| ConnectionPoolExpired | |
| ForTestingOptionalErrorExtraInfo | |
| MovePrimaryInProgress | |
| TenantMigrationConflict | |
| TenantMigrationCommitted | |
| APIVersionError | |
| APIStrictError | |
| APIDeprecationError | |
| TenantMigrationAborted | |
| OplogQueryMinTsMissing | |
| NoSuchTenantMigration | |
| TenantMigrationAccessBlockerShuttingDown | |
| TenantMigrationInProgress | |
| SkipCommandExecution | |
| FailedToRunWithReplyBuilder | |
| CannotDowngrade | |
| ServiceExecutorInShutdown | |
| MechanismUnavailable | |
| TenantMigrationForgotten | |
| SocketException | |
| CannotGrowDocumentInCappedNamespace | |
| NotWritablePrimary | |
| BSONObjectTooLarge | |
| DuplicateKey | |
| InterruptedAtShutdown | |
| Interrupted | |
| InterruptedDueToReplStateChange | |
| BackgroundOperationInProgressForDatabase | |
| BackgroundOperationInProgressForNamespace | |
| MergeStageNoMatchingDocument | |
| DatabaseDifferCase | |
| StaleConfig | |
| NotPrimaryNoSecondaryOk | |
| NotPrimaryOrSecondary | |
| OutOfDiskSpace | |
| ClientMarkedKilled |