Skip to content

Unique constraint failed on session_data_id in sessionData.updateMany() on v3.1.0 #4183

@koo5

Description

@koo5

⚠️ Heads up: AI slop warning. This report was drafted by an LLM from a log snippet I pasted. I've skimmed it and it looks accurate, but I haven't independently verified every claim (code paths, "related to but not covered by the v3.1.0 race-condition fix", etc.). Apologies in advance if any of it is off — feel free to close/ignore if it's not useful.

Describe the Bug

After upgrading to v3.1.0, the umami container logs a PrismaClientKnownRequestError with Unique constraint failed on the fields: (session_data_id) from prisma.sessionData.updateMany(). Looks like a race condition similar to the "Prisma session race condition" fix listed in the v3.1.0 changelog, but on the session_data table — so possibly not covered by that fix, or an adjacent path.

Non-fatal (subsequent events still get recorded), but it's noisy and suggests data may occasionally be lost under concurrent writes for the same session.

Database
PostgreSQL

Relevant log output

PrismaClientKnownRequestError:
Invalid `prisma.sessionData.updateMany()` invocation:


Unique constraint failed on the fields: (`session_data_id`)
    at Gr.handleRequestError (/app/node_modules/.pnpm/@prisma+client@7.6.0_.../node_modules/@prisma/client/runtime/client.js:65:8286)
    at Gr.handleAndLogRequestError (.../client.js:65:7581)
    at Gr.request (.../client.js:65:7288)
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    at async a (.../client.js:75:6730)
    at async m (/app/.next/server/chunks/[root-of-the-server]__0ozrkfc._.js:2149:763)
    at async A (/app/.next/server/chunks/[root-of-the-server]__0a~k0jg._.js:1:4261)
    at async rB.do (.../next-server/app-route-turbo.runtime.prod.js:5:20926)
    at async rB.handle (.../next-server/app-route-turbo.runtime.prod.js:5:25709)
    at async u (/app/.next/server/chunks/[root-of-the-server]__0z~fkta._.js:1:8294)
{
  clientVersion: '7.6.0',
  name: 'PrismaClientKnownRequestError'
}

Which Umami version are you using?
v3.1.0 (ghcr.io/umami-software/umami:postgresql-latest @ sha256:e3f80c0625aad7179b49da27d475357cabb1068b8cacd9a792cfd6966888b123, built 2026-04-16 23:45 UTC)

How are you deploying your application?
Docker (docker compose), self-hosted

Which browser are you using?
N/A — server-side error triggered by tracker events

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions