explain-my-error
v1.0.12
Published
AI-powered CLI to explain programming errors with fixes and ELI5 output.
Downloads
740
Maintainers
Readme
explain-my-error
Turn confusing programming errors into clear fixes directly in your terminal.
explain-my-error returns:
- A plain-English explanation
- Common root causes
- Likely root cause based on context
- 2-3 alternative hypotheses with confidence
- Ranked fix plans (fast patch / proper fix / long-term fix)
- Framework-specific recipes (React/Next.js/Node/Express/TypeScript)
- Copy-paste remediation commands
- Verify checklist
- A practical fix
- A code example
- An ELI5 summary
Alias included: eme
Install
Install in a project:
npm i explain-my-errorInstall globally (recommended for CLI usage from anywhere):
npm i -g explain-my-errorThen run:
explain-my-error --help
# or
eme --helpSet your API key
Required: GROQ_API_KEY
If the key is missing, the CLI will prompt for it interactively and can save it to a local .env file.
macOS/Linux (zsh/bash):
export GROQ_API_KEY="your_groq_api_key"Windows PowerShell:
$env:GROQ_API_KEY="your_groq_api_key"Global install note
If you installed globally with npm i -g explain-my-error:
- Interactive key setup saves
.envin your current working directory. - For using the CLI from any folder, set
GROQ_API_KEYin your shell profile.
Persist on macOS/Linux:
echo 'export GROQ_API_KEY="your_groq_api_key"' >> ~/.zshrc
source ~/.zshrcUsage
Interactive mode
explain-my-erroremeInline message
explain-my-error explain "TypeError: Cannot read property 'map' of undefined"eme explain "ReferenceError: x is not defined"Context-aware input
eme explain "TypeError: Cannot read property 'map' of undefined" \
--framework react \
--runtime "node 20" \
--stack "at App (src/App.tsx:12:5)" \
--code "items.map(item => item.id)"eme explain --stack-file ./error.log --code-file ./src/App.tsx --framework nextjsJSON mode
eme explain "ReferenceError: x is not defined" --jsonPiped input
cat error.txt | explain-my-errornpm run build 2>&1 | emeCommand reference
explain-my-error [command]Commands:
explain [error...]Explain a programming error--jsonReturn structured JSON output--stack,--stack-fileAdd stack trace context--code,--code-fileAdd code snippet context--runtimeAdd runtime context--frameworkAdd framework context--helpShow CLI help--versionShow CLI version
Example output
========================================================================
| EXPLAIN MY ERROR |
| AI powered debugging for humans |
========================================================================
ERROR: TypeError: Cannot read property 'map' of undefined
------------------------------------------------------------------------
EXPLANATION
This happens when .map() is called on a variable that is undefined.
------------------------------------------------------------------------
------------------------------------------------------------------------
COMMON CAUSES
1. API data not loaded
2. State not initialized
3. Incorrect variable reference
------------------------------------------------------------------------
FIX
Ensure the array exists before calling map.
------------------------------------------------------------------------
CODE EXAMPLE
const items = data?.items ?? [];
items.map(...)
------------------------------------------------------------------------
------------------------------------------------------------------------
ELI5
Your code expected a box of toys (an array), but the toy box was empty.
------------------------------------------------------------------------Open Agent Skill
- Skill spec:
skills/SKILL.md - Skill function:
runExplainErrorSkill(input)
