overleaf/overleaf · error
fatal error
Error message
fatal error
What it means
This is the top-level catch-all of the bulk_resync_file_fix_up script. Any uncaught error from the main flow (e.g. a rethrown flush failure, DB connection loss, iteration crash) is logged as 'fatal error' and the process exits with code 100. It is a wrapper, not a domain error; the real cause is in the logged err object.
Source
Thrown at services/project-history/scripts/bulk_resync_file_fix_up.mjs:325
try {
try {
await main()
} finally {
clearInterval(logInterval)
logStats()
Metrics.close()
await mongoClient.close()
// TODO(das7pad): graceful shutdown for redis. Refactor process.exit when done.
}
console.log('Done.')
await setTimeout(1_000)
if (STATS.failure) {
process.exit(Math.min(STATS.failure, 99))
} else {
process.exit(0)
}
} catch (err) {
logger.err({ err }, 'fatal error')
await setTimeout(1_000)
process.exit(100)
}
View on GitHub (pinned to 28ad3b03b7)
Solutions
- Read the err field in the 'fatal error' log line to identify the root cause; exit code 100 only signals an unhandled crash.
- Re-run the script once mongo/redis connectivity and credentials are verified (the script is resumable/idempotent for remaining projects).
- Check STATS.failure counts in earlier logs to see how many projects failed before the crash.
- If crashes recur at the same project, inspect that project's data for corruption or malformed records.
Defensive patterns
Strategy: try-catch
Try / catch
try {
await main()
} catch (err) {
logger.err({ err, stack: err.stack, cause: err.cause }, 'fatal error')
process.exitCode = 100
} Prevention
- Always read the err object in the 'fatal error' log before acting; exit code 100 is only a wrapper signal.
- Pre-validate mongo/redis connectivity before starting the batch.
- Wrap per-project work in its own try/catch so one bad project can't kill the whole run.
- Record progress/checkpoints so re-runs after a crash are cheap.
When it happens
Trigger: Any throw escaping the main try block: rethrown flush errors during shutdown, mongo/redis connection failures, or bugs in the batch loop.
Common situations: Database credential/config changes mid-run, network partition to mongo/redis, unhandled exceptions in the resync loop, manual kill causing state races.
Related errors
- failed to flush updates, trying again
- pandoc latex-to-document conversion failed
- zip compression of export failed
- Non-zero exit code from pdftocairo
- blocking resync doc content insert into project history queu
AI-assisted analysis of overleaf/overleaf@28ad3b03b7 (2026-09-03).
Data as JSON: /api/errors/652b58e5d6edda17.
Report an issue: GitHub.