Translate cryptic JavaScript errors into human-readable solutions instantly.
**ErrLens** is a professional-grade CLI utility designed to eliminate developer frustration. It intercepts Node.js crashes, analyzes stack traces, and delivers plain-English explanations with actionable fixesβdirectly in your terminal.
- π Instant Diagnostics β No more context-switching to Google or StackOverflow.
- π Live Monitoring β Catch errors in real-time using the
errlens runcommand. - π§ Fuzzy Logic Engine β Matches messy stack traces and typos using
Fuse.js. - π¨ Beautiful UI β High-visibility terminal output powered by
boxenandchalk. - π€ CI/CD Ready β Export raw data via
--jsonfor automated error reporting.
Install globally via npm to use the errlens command anywhere in your terminal:
npm install -g errlensRun your script through ErrLens. If it crashes, ErrLens intercepts the error and explains the fix before the process exits.
errlens run your-app.jsFound a weird error in your logs? Just paste the message:
errlens "TypeError: Cannot read properties of undefined"Get machine-readable results for your own tooling or automated reports:
errlens "is not a function" --jsonRun a script and write the JSON report directly to a file in CI:
errlens run test.js --json > ci-report.jsonIn --json mode, ErrLens prints only JSON (no spinner, colors, or terminal boxes).
Example response from run:
{
"code": 0,
"count": 0,
"matches": []
}Example response from analyze <errorString> (match found):
{
"code": 1,
"count": 1,
"matches": [
{
"name": "TypeError: Cannot read properties of undefined",
"match": "Cannot read properties of undefined",
"explanation": "You are trying to access a property on a variable that is currently empty.",
"why": "The variable wasn't initialized, or an API call hasn't finished yet.",
"fixes": [
"Use optional chaining: user?.name",
"Set a default value: data || []"
],
"example": "const name = user?.name || 'Guest';"
}
]
}Exit codes (useful for CI):
run <file>exits with the child process exit code.analyze <errorString>exits with1when matches are found (intentional, so CI can fail when known errors are detected), otherwise0.
This follows Unix conventions where 0 means success and non-zero means failure. If you prefer success-on-detection in CI, invert the check in your pipeline logic (for example, treat exit code 1 from analyze <errorString> as a pass condition).
ErrLens operates on a three-stage intelligent pipeline to turn confusion into clarity:
| Phase | Component | Description |
|---|---|---|
| Interception | auto.js |
Hooks into the uncaughtException event via a preload script. |
| Matching | matcher.js |
Uses fuzzy search against database.json to find the root cause. |
| Formatting | formatter.js |
Wraps the diagnosis in a clean, color-coded terminal interface. |
errlens/
βββ bin/index.js # CLI Entry point & Command routing
βββ lib/
β βββ matcher.js # Fuzzy search & Logic engine
β βββ formatter.js # UI & Terminal styling
β βββ auto.js # Automation & Error interception
β βββ database.json # The "Knowledge Base" (Dictionary)
βββ package.json # Dependencies & Metadata
βββ README.md # Documentation
We are building the world's most comprehensive dictionary of JavaScript errors, and we need your help!
- Fork the repository.
- Add a new error entry to
lib/database.json. - Submit a Pull Request.
π‘ Tip: Every error you add helps another developer save valuable time. Join the mission!
Distributed under the MIT License. See LICENSE for more information.
Built with β€οΈ by BeyteFlow
Making the terminal a friendlier place, one error at a time.

