Explain a developer error
explain_errorDiagnose raw developer error messages or logs offline and return documented causes with ranked fixes for CORS, ESM/CommonJS, npm, Next.js, and Postgres issues.
Instructions
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.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| error | Yes | The raw error message or log excerpt, verbatim (max ~200 KB). Include the lines around the error: stack trace, npm log block, "Node.js vX" footer, or the full connection string. | |
| client | No | Optional database client for connection-string advice (default prisma). | |
| node_version | No | Optional Node.js version in use (e.g. "20.10.0"), used to tailor ESM/CommonJS advice. Usually detected from the error text itself. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tool | Yes | Always "dev-error-explainers". | |
| engine | Yes | The code path that produced the diagnosis (src/contract.js). | |
| matched | Yes | True when at least one explainer recognised the input. | |
| results | Yes | One Diagnosis per finding, most severe first (docs/CONTRACT.md); empty when matched is false. | |
| version | Yes | Package version that produced the result. | |
| redactions | Yes | Number of values masked in the output. |