Dev error explainers

io.github.mahdibrr由 GitHub 账号 mahdibrr 发布v0.2.1更新于 Oct 24, 2026

Offline, deterministic cause and fix for Node, npm, Next.js, CORS and Postgres URL errors.

已验证STDIO仅桌面数据库开发者工具

概览

AI 生成的概览

离线 MCP 服务器,为粘贴的 Node、npm、Next.js、CORS 与 Postgres 报错给出确定性的原因与修复方案。

可以做什么
  • 解释粘贴的报错:按已记录的规则匹配 CORS、ESM/CJS、npm ERESOLVE、Next.js 构建失败、chunk/缓存问题与 Postgres 连接错误,返回原因、修复方案与引用来源。
  • 诊断数据库连接串:检查连接池与直连、端口、SSL 及未编码的密码字符,返回密码已掩码的修正 URL。
  • 审计环境变量文件:标记公开密钥迹象、重复赋值、非法行与生产环境回环地址,且不返回键名或值。
  • 无法识别的输入会如实报告为未识别,而不是猜测。
适用场景
适合让助手在不把日志发送到外部服务的前提下,排查构建、依赖、CORS 或数据库连接失败。最适用于使用 PostgreSQL 或 Supabase 的 Node.js 与 Next.js 项目。
运行要求
通过 npx 以 stdio 在本地运行(包名 dev-error-explainers,服务器命令 dev-error-explainers-mcp)。需要 Node.js 20 或更高版本,且仅支持 ES 模块。无需 API 密钥、账号或网络访问。
安装前请注意
数据库 URL 诊断会读取原始 postgres:// 行(含密码)以判断原因,但不会打印该密码;连接串始终以掩码形式显示。环境审计在本地检查原始值且不返回键名或值,但审计无发现并不代表配置安全。粘贴的文本由助手宿主按其自身数据政策处理。部分结论(尤其是构建错误解码)链接到作者自己的网站而非一手来源。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Dev error explainers,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

dev-error-explainers

[npm version] [test] [license: MIT] [Dev Error Explainers on AI Agents Listing] [Dev error explainers MCP server]

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

[A Node.js ERR_REQUIRE_ESM error piped into npx dev-error-explainers, which prints the cause, three ranked fixes and the Node.js docs link]

bash
npm run build 2>&1 | npx dev-error-explainers
bash
npm install dev-error-explainers
js
import { 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:

text
[ '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.

ModuleMain export (dev-error-explainers)What it explainsTry it live
cors-error-explainerdiagnoseCorsChrome / Firefox / Safari "blocked by CORS policy" errors: missing or wrong Access-Control-Allow-* headers, preflight failures, credentials, mixed content — with a fix for your stackCORS Error Explainer
esm-cjs-explainerexplainEsmCjsERR_REQUIRE_ESM, "Cannot use import statement outside a module", "exports is not defined in ES module scope", ERR_UNKNOWN_FILE_EXTENSION ".ts", ERR_MODULE_NOT_FOUND, ERR_PACKAGE_PATH_NOT_EXPORTED — aware of your Node.js versionESM/CJS Error Explainer
npm-eresolve-explaineranalyseEresolveLognpm ERR! ERESOLVE peer-dependency conflicts: who asks for which range, what is installed, and why they do not intersectnpm ERESOLVE Explainer
chunk-cache-explainerdiagnoseChunkCacheChunkLoadError / "Loading chunk failed" after a deploy: reads your response headers and finds the stale HTML, the CDN cache hit or the SPA fallbackChunkLoadError Cache Checker
database-url-doctordiagnoseDatabaseUrlPostgres / Supabase connection strings: pooler vs direct, port 5432 vs 6543, pgbouncer, SSL, unencoded password characters — with a corrected URL for Prisma, Drizzle, pg or psqlDATABASE_URL Doctor
build-error-decoderdecodeBuildErrorFailing next build / next dev output: Suspense bailouts, dynamic server usage, window is not defined, hydration mismatches, module resolution, heap out of memory, EADDRINUSE…Next.js Build Error Decoder
next-env-checkerauditEnvExplicit audit of one Next.js .env file: public secret indicators, duplicate assignments, invalid lines and production loopback URLs. Values never returnedEnv audit contract
database-connection-explainerexplainDatabaseConnection"Can't connect to the database" from Node.js apps on PostgreSQL: ECONNREFUSED (including ::1 localhost), ETIMEDOUT, ENOTFOUND, Prisma P1000 / P1001 / P1017, password authentication failed, no pg_hba.conf entry, too many clients, self-signed certificates. Generic network codes are only diagnosed next to a Postgres signalNo 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:

js
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; // truer.findings;      // what is wrong, why, and the sourcer.fix;           // a fix for the detected (or guessed) stack
js
import {  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 firstexplainDatabaseConnection({ 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

js
import { auditEnv } from 'dev-error-explainers';const audit = auditEnv(envText, { environment: 'production' });// { version: '0.1', status, assignments, matched, redactions, results }
bash
npx dev-error-explainers --only env --environment production --json .env.local

This 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.

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:

js
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.

bash
npm run build 2>&1 | npx dev-error-explainersnpx dev-error-explainers < error.lognpx dev-error-explainers --text "Error [ERR_REQUIRE_ESM]: require() of ES Module …" --node 18.17.0npx 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.

yaml
      - 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 red

Inputs, 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:

bash
claude mcp add dev-error-explainers -- npx -y -p dev-error-explainers dev-error-explainers-mcp

Claude 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:

sh
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:

text
/plugin marketplace add mahdibrr/dev-error-explainers/plugin install dev-error-explainers@dev-error-explainers

Principles

  • 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

bash
npm installnpm test

CI 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

MIT

Maintainer and project context

Maintained by Mahdi Ben Rhouma.

来源:README.md,提交 0fc912a

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

2
  1. v0.2.1最新Oct 8, 2026
  2. v0.2.0Sep 30, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分