Fix your error. Get back to shipping.
Clear, tested fixes for the Next.js, Prisma, PostgreSQL, and Express errors that stop you cold at 2am.
Latest fixes
Loading articles...
Clear, tested fixes for the Next.js, Prisma, PostgreSQL, and Express errors that stop you cold at 2am.
Loading articles...
Your app is trying to connect to a PostgreSQL server on localhost, but nothing is listening there — either your local Postgres isn't running, or `DATABASE_URL` still points at localhost when it should point at your actual hosted database (like Neon).
An async route handler threw an error that nothing caught — Express 4 doesn't automatically catch rejected promises in async route handlers, so the error escapes silently instead of reaching your error-handling middleware. Wrap async handlers in a try/catch (or a helper like `asyncHandler`) that forwards errors to `next()`.
Another process is already using the port your server is trying to listen on — often a previous `npm run dev` that didn't fully shut down. Kill the process using that port, or change your server's port in `.env`.
This is a server-wide connection limit, distinct from the per-role "too many connections for role" error — the entire database instance has hit its max_connections ceiling from all roles combined. It's the same root fix as the per-role version: use a connection pooler in serverless environments, and make sure you're not creating a new PrismaClient per request.
You're trying to insert a string longer than the column's defined length limit. Either validate and truncate the input before saving, or increase the column's length limit — for genuinely long text (like article content), use `TEXT` instead of a length-limited `VARCHAR`.
Prisma's client was generated against a schema that includes a model whose table was never actually created in this specific database — usually because migrations haven't been applied to this environment, or you're connected to the wrong database entirely.
You're trying to create or update a record that references a foreign key ID which doesn't exist in the related table — for example, creating an Article with a `pillarId` that doesn't match any real Pillar. Verify the referenced ID actually exists before the write, or handle the error to show a clear message.
`useRouter` (and other client-only hooks like `usePathname`, `useSearchParams`) can only run inside a Client Component. Add `"use client"` as the very first line of the file, or move the navigation logic into a smaller Client Component if the rest of the file needs to stay a Server Component.
You're passing an `onClick` (or similar) handler from a Server Component down to a Client Component. Functions can't cross the server/client boundary — the Client Component needs to define its own handler internally, or the interactive part needs to become its own `'use client'` component.
You're rendering an array with `.map()` but not passing a `key` prop to each element, or you're using the array index as the key on a list that can reorder. Give each item a stable, unique `key` from your actual data — usually an `id` field.
A state update is triggering a re-render that triggers the same update again, looping forever. The most common cause is calling `setState` directly in the render body, or inside a `useEffect` with a dependency array that changes every render.
You're passing something non-serializable — a class instance, a Date in some cases, a function, or a Prisma model with methods attached — as a prop from a Server Component to a Client Component. Convert it to a plain object first, usually with `JSON.parse(JSON.stringify(data))` or by manually picking the fields you need.