- Home
- Skills
- Frontend & Web Apps
- Next.js 15 + Prisma Error Architect
More screenshots
Works with the AI Agents you already use
Next.js 15 + Prisma Error Architect
Production-grade error boundary architecture for Next.js 15 App Router + Prisma. Maps Prisma codes to safe messages, adds smart retries, and enforces correct error.tsx patterns so raw errors never reach users.
$15
Next.js 15 + Prisma Error Architect
Example session with this skill installed
I'm getting this error in production on my Next.js 15 App Router dashboard:
Unhandled error in Server Component render
Segment: /app/dashboard/orders/page.tsx
Error: PrismaClientKnownRequestError
code: 'P2024'
message: 'Timed out fetching a new connection from the connection pool.'
(pool size: 5, timeout: 10s)
Digest: 2847193021
The raw message is showing to users. How do I fix this properly?
- Read your context and instructions
- Compiled the next js 15
- Generated the UI component
Diagnosis
Server Component render error caused by Prisma connection pool timeout (P2024). The nearest boundary should be app/dashboard/error.tsx.
Root cause
The query is not wrapped in a retry helper and the raw Prisma message is leaking to the client.
Fix
// lib/db-retry.ts
const RETRYABLE = new Set(['P2024', 'P1001', 'P1017']);
export async function withDbRetry<T>(fn: () => Promise<T>, maxAttempts = 3): Promise<T> {
let lastErr: unknown;
for (let i = 0; i < maxAttempts; i++) {
try {
return await fn();
} catch (e: any) {
lastErr = e;
if (!RETRYABLE.has(e?.code)) throw e;
await new Promise(r => setTimeout(r, 100 * 3 ** i));
}
}
throw lastErr;
}
// Usage
const orders = await withDbRetry(() =>
prisma.order.findMany({ where: { userId } })
);
Safe message mapping
P2024 → “Server is busy. Please try again in a moment.”
Boundary placement
Create or update app/dashboard/error.tsx (must include 'use client'). Show the digest as a reference for support tickets.
Prisma mapping
- Code: P2024
- User message: Server is busy. Please try again in a moment.
- Retry: Yes (3 attempts with 100/300/900ms backoff)
Checklist confirmation
Items 2, 4, 5 and 7 from the pre-deploy checklist apply and must be verified before shipping.
This turns a typical 40-minute production firefight into a structured 6-minute fix.
error.tsx
TSX · React component
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
Stop leaking raw Prisma errors and stack traces to your users in Next.js 15.
This skill gives your agent a complete production error-handling system for App Router + Prisma projects. It classifies the error origin, maps Prisma codes (P2002, P2024, P1001, P1017 and more) to safe user-facing messages, applies the correct retry policy, and forces the proper boundary (error.tsx, global-error.tsx, or client boundary).
What the skill does
- Diagnoses whether the error came from a Server Component, Server Action, or Route Handler
- Maps every common Prisma error code to a clean, non-leaking message
- Adds exponential-backoff retry for connection pool and transient DB errors
- Tells you exactly which file and segment needs the boundary
- Enforces a 7-item pre-deploy checklist so nothing ships incomplete
Hard rules the skill never breaks
- Never recommends try/catch inside Server Component render bodies
- Never lets raw Prisma messages or stack traces reach the client
- Never swallows redirect() or notFound() without unstable_rethrow
- Always distinguishes Server Component errors from Server Action results
Includes three reference files (error map, RSC fallback patterns, pre-deploy checklist) and a real anonymized production log showing before/after impact (40 min → 6 min resolution).
Ideal for agencies, senior freelancers, and teams shipping Next.js 15 apps that use Prisma.
Limits of this skill
- Only works with Next.js 15 App Router (does not support Pages Router)
- Only designed for Prisma (does not support Drizzle, Kysely, TypeORM, or raw SQL)
- Does not handle tRPC or GraphQL error patterns
- Does not cover pure client-side React errors
- Does not handle authentication/authorization errors (NextAuth, Clerk, etc.)
- Does not cover rate limiting or 429 errors
- Does not configure infrastructure (only suggests pool size and PgBouncer)
- Does not integrate with logging tools (Sentry, LogRocket, etc.)
- Does not fix TypeScript or build errors
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 14 days ago