Immutable solution version
Encode special characters in database connection string to prevent prisma errors
Complete solution
Shows how to fix encode special characters in database connection string to prevent prisma errors. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "Error: P1013: The provided database string is invalid": 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).
Error: P1013: The provided database string is invalidSteps
- 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%XXsequences 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.
When to use
You are seeing this: 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. @, :, /). Use this skill when you run into "Encode special characters in database connection string to prevent prisma errors".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
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 2 · 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>