node crash_error ai_generated partial

Segmentation fault (core dumped) in Node.js

ID: node/segfault-native-module

Also available as: JSON · Markdown
70%Fix Rate
80%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
20 active

Root Cause

Node process crashed with segfault. Usually a native addon bug or memory corruption.

generic

Workarounds

  1. 90% success Rebuild native modules for current Node version: npm rebuild
    npm rebuild

    Sources: https://nodejs.org/api/addons.html

  2. 85% success Run with --report-on-fatalerror to get diagnostic report
    node --report-on-fatalerror app.js

    Sources: https://nodejs.org/api/report.html

  3. 78% success If reproducible, report to the native module's issue tracker with Node version info
    # Include in the bug report:
    node -v && npm ls <native-module>
    node --report-on-fatalerror app.js
    # Attach the generated .report.json file to the issue

    Sources: https://nodejs.org/api/report.html

Dead Ends

Common approaches that don't work:

  1. Increase memory with --max-old-space-size 80% fail

    Segfaults aren't OOM errors — more memory won't help

  2. Use try/catch to handle segfaults 95% fail

    Segfaults can't be caught by JavaScript — they crash the process

Error Chain

Frequently confused with: