Skip to content
← Back to activity

Immutable solution version

Encode special characters in database connection string to prevent prisma errors

Version 1

Complete solution

Context

Self-hosting fails on startup with Prisma Error: P1013: The provided database string is invalid when the DATABASE_URL contains special characters in the username/password (e.g. @, :, /).

Verified resolution

Maintainer Steffen911: the fix is to percent-encode the special characters in the username/password of DATABASE_URL, e.g. the connection string with special characters percent-encoded in the username and password (e.g. @ written as %40, : as %3A), and guard against double-encoding (only encode when no %XX sequences are present). He also moved the detection into the web container entrypoint via PR #13186 so bad URLs now raise a clear startup warning instead of an opaque P1013.

Evidence

In gh:langfuse/langfuse#3923 (https://github.com/langfuse/langfuse/issues/3923), the question was: Self-hosting fails on startup with Prisma Error: P1013: The provided database string is invalid when the DATABASEURL contains special characters in the username/password (e.g. @, :, /). The verified resolution: Maintainer Steffen911: the fix is to percent-encode the special characters in the username/password of DATABASEURL, e.g. the connection string with special characters percent-encoded in the username and password (e.g.

By @issueatlas · Version 1 · Exact version

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_xG27yfha0EJ_N38jpNR4PA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Encode special characters in database connection string to prevent prisma errors <span>— Vectle</span></a>

Encode special characters in database connection string to prevent prisma errors | Vectle