dev-error-explainers
The server exposes a single explain_error MCP tool for offline, deterministic diagnosis of pasted developer errors.
Explain Node.js ESM/CommonJS, npm ERESOLVE, Next.js build/dev, browser CORS, Postgres/Supabase connection-string, and Postgres connection errors.
Accept raw error text up to ~200 KB, with optional
client(prisma,drizzle,pg,psql) andnode_version.Return a human-readable cause/fix plus structured JSON: matched findings, severity, confidence, fixes, evidence, rule IDs, and redaction count.
Mask recognizable secrets such as URL passwords, tokens, JWTs, and key/token query parameters.
Be read-only, idempotent, non-destructive, closed-world/offline, and honest about unrecognized input instead of guessing.
Note: the provided schema exposes only
explain_error; the README also mentionsaudit_env, but it is not present in this schema.
Provides database connection-string advice for Drizzle, diagnosing PostgreSQL/Supabase URL issues and suggesting corrected connection strings.
Decodes failing Next.js build and dev output, explaining causes and ranked fixes for build, prerender, hydration, module-resolution, and runtime errors.
Explains Node.js ESM/CommonJS and module-resolution errors with version-aware causes and ranked fixes.
Analyzes npm ERESOLVE peer-dependency conflict logs to explain who requires what, why ranges conflict, and how to fix them.
Diagnoses PostgreSQL connection strings and connection errors, including refused/timeout/DNS failures, authentication issues, pg_hba rules, client limits, and SSL problems.
Provides Prisma-specific database connection-string advice and explains Prisma P1000/P1001/P1017 connection errors.
Diagnoses Supabase pooler vs direct DATABASE_URL connection strings, including port, pooler, SSL, and password-encoding issues, with corrected URL guidance.
dev-error-explainers
Paste an error. Get a deterministic explanation.
Version 0.4.0 adds an explicit environment audit and native assistant setup. Public database helpers now return masked metadata and URL templates; see the migration notes before upgrading from 0.2.x. The 1.0 verification record remains incomplete.
No LLM · no API · no network · no telemetry
npm run build 2>&1 | npx dev-error-explainersnpm install dev-error-explainersimport { detect, explainEsmCjs } from 'dev-error-explainers';
const error = 'Error [ERR_REQUIRE_ESM]: require() of ES Module /app/node_modules/node-fetch/src/index.js from /app/index.js not supported.';
console.log(detect(error));
const { findings } = explainEsmCjs({ error, nodeVersion: '20.10.0' });
console.log(findings[0].title, findings[0].fixes.map((f) => f.title));Output:
[ 'esm-cjs-explainer' ]
ERR_REQUIRE_ESM — require() of an ES module [
'Upgrade Node.js (you are on 20.10.0)',
'Use dynamic import() from CommonJS',
'Convert the calling file to ESM'
]Eight small, pure JavaScript modules with zero runtime dependencies: seven error explainers and one explicit environment-file audit. The seven explainers recognise
error text a developer pastes (from the browser console, npm, next build,
curl -I, a Node.js stack trace…), explains why it happens, and returns concrete fixes
with a link to the primary source where one exists (MDN, the Node.js docs, the npm docs,
the PostgreSQL docs, the Supabase docs…). The same engine runs as a library, a CLI, a
GitHub Action and an MCP server.
Secrets: error diagnosis in the CLI, Action and MCP server passes the input through redact()
before it is analysed, with one exception in error diagnosis: the DATABASE_URL doctor reads the raw
postgres:// line (a password's exact characters decide the diagnosis), and never
prints that password. Library diagnostics also mask recognised credentials in
build evidence and database query components. The separate auditEnv / audit_env
audit inspects raw values locally to classify keys, but returns no input keys or
values. Public database parsing helpers now return masked metadata;
correctedWithPassword is a deprecated alias returning masked corrections.
See the 0.3 migration and confidentiality limits
and what redaction does not catch.
Six of them power the free tools on iloveblogs.blog/tools, where you can try each one in the browser.
Module | Main export ( | What it explains | Try it live |
|
| Chrome / Firefox / Safari "blocked by CORS policy" errors: missing or wrong | |
|
|
| |
|
|
| |
|
|
| |
|
| Postgres / Supabase connection strings: pooler vs direct, port 5432 vs 6543, | |
|
| Failing | |
|
| Explicit audit of one Next.js .env file: public secret indicators, duplicate assignments, invalid lines and production loopback URLs. Values never returned | |
|
| "Can't connect to the database" from Node.js apps on PostgreSQL: | No browser tool yet — rules and sources |
Evidence: most findings cite the primary source they were checked against. The build-error decoder has no primary-source URL; its links point to articles on the author's site, iloveblogs.blog.
Node.js 20 or later. ES modules only.
See input/resource limits,
the prospective evaluation report, and
the execution record for the measured scope and gaps.
npm run check:drift, npm run typecheck and npm test are release gates.
The development fixture score is not independent accuracy.
Usage
Everything is available from the package root, and each module can also be imported on its own:
import { diagnose } from 'dev-error-explainers/cors-error-explainer';
const r = diagnose({
error: "Access to fetch at 'https://api.example.com/data' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.",
});
r.isCorsProblem; // true
r.findings; // what is wrong, why, and the source
r.fix; // a fix for the detected (or guessed) stackimport {
analyseEresolveLog, diagnoseDatabaseUrl, diagnoseChunkCache, decodeBuildError, explainDatabaseConnection,
} from 'dev-error-explainers';
analyseEresolveLog(npmOutput); // { detected, code, conflicts: [...] }
diagnoseDatabaseUrl(process.env.DATABASE_URL, { client: 'prisma' }); // { ok, kind, findings, corrected }
diagnoseChunkCache({ htmlHeaders, chunkHeaders }); // headers from `curl -I`
decodeBuildError(nextBuildOutput); // matched rules, most severe first
explainDatabaseConnection({ error: stackTrace }); // { recognised, findings, related }detect(text)
Returns the names of the modules that recognise text, in a fixed order, or [].
Each module is asked through its own recogniser — detect adds no heuristics of its own.
Note that chunk-cache-explainer reads HTTP response headers (the output of curl -I),
not the ChunkLoadError message itself; the message alone is recognised by
build-error-decoder.
Audit an environment file
import { auditEnv } from 'dev-error-explainers';
const audit = auditEnv(envText, { environment: 'production' });
// { version: '0.1', status, assignments, matched, redactions, results }npx dev-error-explainers --only env --environment production --json .env.localThis mode never prints file contents or assignment values. The MCP equivalent
is audit_env({ env: envText, environment: "production" }). Error auto-diagnosis
and the GitHub Action do not automatically treat logs as environment files.
An audit with no findings does not certify that the configuration is safe.
See the parsing scope, rules and limits.
Related MCP server: Hivemind
JSON contract
Every module has its own result shape. diagnose(text) maps all of them onto one
shape with stable rule ids, after redacting the input — the shape the CLI prints with
--json, the GitHub Action renders and the MCP server returns:
import { diagnose } from 'dev-error-explainers'; // or 'dev-error-explainers/contract'
diagnose('FATAL: password authentication failed for user "andym"');
// { version: '0.1', matched: true, redactions: 0,
// results: [{ rule: 'database-connection.password-auth-failed', family: 'database-connection',
// severity: 'critical', confidence: 'high', title, cause, fixes, evidence, module }] }Unknown input gives { matched: false, results: [] } — never a closest guess. The shape,
the full rule table, the confidence semantics and the redaction limits are in
docs/CONTRACT.md.
A public corpus of real pasted errors with their expected results lives in
fixtures/, each case with its source.
redact(text) is exported too (dev-error-explainers/redact).
CLI
Pipe a failing command into it, or pass a log file. Nothing is sent anywhere.
npm run build 2>&1 | npx dev-error-explainers
npx dev-error-explainers < error.log
npx dev-error-explainers --text "Error [ERR_REQUIRE_ESM]: require() of ES Module …" --node 18.17.0
npx dev-error-explainers --json < error.log # the contract result (docs/CONTRACT.md)Flags: --only cors|esm|eresolve|build|database-url|database-connection|chunk-cache|env, --json,
--node <version>, --client prisma|drizzle|pg|psql, --html-headers <file> --chunk-headers <file>,
--help, --version. npx dev-error-explainers mcp starts the MCP server.
Exit codes: 0 an error was recognised, 2 nothing recognised (nothing is guessed), 64 usage error.
A connection string is always printed with its password masked.
Use it in CI (GitHub Action)
When a step fails, the Action reads the log you saved from it and writes the cause and the fix to the job summary, with annotations on the file and line when the log names a file in your checkout. No network, no LLM, no token.
- name: Build
id: build
continue-on-error: true # let the explain step run…
shell: bash
run: |
set -o pipefail
npm run build 2>&1 | tee build.log
- name: Explain the failure
if: steps.build.outcome == 'failure'
uses: mahdibrr/dev-error-explainers@v0
with:
log-file: build.log
- name: Fail the job if the build failed
if: steps.build.outcome == 'failure'
run: exit 1 # …then keep the job redInputs, outputs and why pipefail and steps.build.outcome matter:
docs/ACTION.md.
Use it from your AI assistant (MCP)
An MCP server with two tools, explain_error and audit_env, so an assistant can check a pasted error or explicitly audit an environment file. explain_error checks the pasted error
against the documented cause before it guesses. Offline and deterministic; unrecognised
input is reported as such. Claude Code:
claude mcp add dev-error-explainers -- npx -y -p dev-error-explainers dev-error-explainers-mcpClaude Desktop, Cursor, VS Code and the protocol details: docs/MCP.md.
Codex can use the same local stdio server; see native Codex setup. The recorded test uses actual MCP tool receipts, not a simulated assistant.
Use it in Claude Code (plugin: skill + MCP)
The plugin bundles its local MCP server and a skill that tells Claude when to call it. The engine has no integrated AI provider. Load a cloned repository or extracted plugin from your project with:
claude --plugin-dir "/absolute/path/to/dev-error-explainers"Node.js 20+ must be on PATH. The server runs directly from the plugin's files, with no npm download or dependency installation. See native setup and limits. The repository also contains a marketplace definition; remote installation uses the repository version, which can differ from an older local checkout:
/plugin marketplace add mahdibrr/dev-error-explainers
/plugin install dev-error-explainers@dev-error-explainersPrinciples
Deterministic. The same input always gives the same answer; the rules are tested against real error text (Stack Overflow questions, GitHub issues, framework output).
Offline engine. The deterministic library/CLI/MCP server makes no network request. An assistant host handles pasted text under its own data policy; see native integration privacy.
Cited where possible. Findings link to the documentation that states the rule, where one exists — not every rule cites a source.
Honest about unknowns. An error the module does not recognise is reported as not recognised, never guessed.
Selected corrections have actual before/after evidence; alternatives remain unverified by repair execution. See fix verification scope.
Tests
npm install
npm testCI runs the suite on Node.js 20, 22 and 24.
Contributing
Unrecognised error? Open an issue with the exact text. Paste the error as printed, the command that produced it, and the tool versions. A new rule needs a test built from a real error. A diagnosis that is wrong is a bug too — there is a separate template for that.
License
Maintainer and project context
Maintained by Mahdi Ben Rhouma.
Project notes and browser tools - How the offline library connects to browser tools, the CLI and public examples.
Available Tools
1 toolexplain_errorExplain a developer errorARead-onlyIdempotent
Explain a concrete developer error message or log excerpt and return its documented cause and fix.
Call it when the user pastes (or you captured from a terminal/browser console) an actual error, for example:
Node.js ESM/CommonJS errors: ERR_REQUIRE_ESM, ERR_MODULE_NOT_FOUND, "Cannot use import statement outside a module", "require is not defined in ES module scope".
npm ERESOLVE / peer-dependency conflict logs from npm install.
Next.js
next build/next devoutput (module not found, heap out of memory, server/client component errors, prerender failures).Browser CORS console errors ("has been blocked by CORS policy", preflight, Access-Control-Allow-Origin).
A postgres:// or postgresql:// connection string (DATABASE_URL, Supabase pooler/direct URLs) that fails to connect.
Postgres connection errors from Node.js apps: connect ECONNREFUSED / ETIMEDOUT on 5432, getaddrinfo ENOTFOUND, Prisma P1000/P1001/P1017, "password authentication failed", "no pg_hba.conf entry", "too many clients", self-signed certificate. Pass the raw text verbatim, including the stack trace and the "Node.js vX" footer when present; do not paraphrase it.
Returns a short human-readable diagnosis (cause, why, ranked fixes with code, official source links) plus the same result as structured JSON. If nothing is recognised it answers "No known error recognised — nothing guessed"; then rely on your own reasoning.
Fully offline and deterministic: no network, no LLM, same input gives the same output. Secrets it can recognise (URL passwords, Bearer/Basic tokens, JWTs, token/key query parameters) are masked in the output.
Inputs: error (required), client, node_version. Returns: tool, engine, matched, results, +2 more
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
There is only one tool, so there is no possibility of overlap or misselection between tools. Its purpose (diagnose a concrete developer error message) is clearly stated and distinguishable from any generic reasoning the agent might do.
The single name explain_error follows a clean verb_noun convention and is self-descriptive. There are no other names to conflict with, so consistency is trivially satisfied.
One tool is borderline thin for a server surface, even though it is well-scoped to a single capability. A single-tool server offers no granularity if callers want, e.g., just the structured or just the lookup.
For its narrow stated purpose (explain a pasted error and return cause, fixes, and structured JSON) the surface is self-contained, including an explicit no-match fallback. Coverage is only as broad as its offline known-error database, but no lifecycle operations are obviously missing.
Maintenance
Related MCP Connectors
Archive of verbatim errors with root causes and fixes that AI agents search by exact error string.
Plain-English fixes for Windows, PC games, and code. Search or paste an error. No account needed.
Exact developer checks: email DNS, Supabase RLS, cron, JSON, contrast, time zones, npm/PyPI packages
Look up an API/SDK error; get the source-linked breaking change, deprecation or advisory and fix.
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables AI assistants to manage development workflows by running build commands, executing tests, analyzing package.json files, installing dependencies, and performing code linting. Supports multiple package managers (npm, yarn, pnpm) and provides detailed error reporting for development operations.5MIT
- FlicenseNot gradedqualityDmaintenanceProvides instant access to a searchable knowledge base of 16,000+ community-driven troubleshooting solutions for common coding problems. Includes community feedback and smart ranking to help AI assistants find the most effective solutions.-
- AlicenseAqualityCmaintenanceEnables AI agents to perform exact, reproducible mechanical computation — text diffing, hashing, JSON querying, calendar arithmetic, deadline-bounded regex extraction, CSV parsing, similarity scoring, unit and base conversion — instead of relying on probabilistic guessing. Runs dependency-free, read-only and offline over stdio, with schema validation and hard caps on every operation so no call can hang the client.1544 npmMIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to ground dependency setup, compatibility checks, and major-version migration advice in a project's real runtime, lockfiles, and config files. It parses local project state and npm registry metadata deterministically, then returns tag-pinned install commands, breaking changes, and upgrade steps rather than generic documentation.525 npmMIT