Skip to content
Latchkey

Prisma "prisma db seed" command failed in CI

prisma db seed runs the seed command you declare in package.json. It fails in CI when the seed script itself throws (bad data, missing tables) or when no seed command is configured for Prisma to run.

What this error means

A seed step fails with "The seed command is not configured..." or with the seed script's own error such as a unique-constraint violation, after which the run stops.

Prisma
Error: The seed command is not configured. Please add the following to your package.json:
"prisma": { "seed": "ts-node prisma/seed.ts" }

Common causes

No seed command declared

Prisma looks for prisma.seed in package.json; without it, db seed has nothing to run.

The seed script errors against the schema

Seeding before migrations, or inserting duplicate keys, makes the seed script throw and fail the step.

How to fix it

Declare the seed command

Add the prisma.seed entry so prisma db seed knows what to execute.

package.json
{
  "prisma": {
    "seed": "ts-node prisma/seed.ts"
  }
}

Seed after migrations, idempotently

  1. Run migrate deploy (or db push) before seeding so tables exist.
  2. Make the seed script idempotent (upsert) so re-runs do not violate constraints.
  3. Run prisma db seed after the schema is in place.
Terminal
npx prisma migrate deploy
npx prisma db seed

How to prevent it

  • Declare the seed command in package.json under prisma.seed.
  • Seed only after the schema exists in CI.
  • Write idempotent seeds so repeated CI runs succeed.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →