# WiredTiger error (3) __wt_file_handle_close, file: WiredTiger.wt, close: No such file or directory

- **ID:** `mongodb/wiredtiger-file-close-failed`
- **Domain:** mongodb
- **Category:** system_error
- **Error Code:** `3`
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

The WiredTiger storage engine failed to close a file handle, typically due to a filesystem-level corruption or a stale NFS mount causing the underlying file to be deleted while MongoDB still held a reference.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| MongoDB 5.0 | active | — | — |
| MongoDB 6.0 | active | — | — |
| MongoDB 7.0 | active | — | — |

## Workarounds

1. **Stop mongod, run `mongod --repair` on the data directory, then restart. This rebuilds WiredTiger metadata from remaining data files.** (70% success)
   ```
   Stop mongod, run `mongod --repair` on the data directory, then restart. This rebuilds WiredTiger metadata from remaining data files.
   ```
2. **Restore from a recent backup if repair fails. Use `mongorestore` with the backup dump.** (90% success)
   ```
   Restore from a recent backup if repair fails. Use `mongorestore` with the backup dump.
   ```
3. **If using a replica set, remove the affected node, resync from the primary by clearing the data directory and restarting with `--replSet`.** (85% success)
   ```
   If using a replica set, remove the affected node, resync from the primary by clearing the data directory and restarting with `--replSet`.
   ```

## Dead Ends

- **** — The corruption persists in the WiredTiger metadata; restarting only re-encounters the same error or causes a crash loop. (90% fail)
- **** — This file contains critical storage engine metadata; removing it makes the database unreadable and requires a full resync from replica set or backup. (95% fail)
- **** — Running fsck on a mounted filesystem can cause further corruption; MongoDB requires the data directory to be consistent before repair. (80% fail)
