litellm - 💡(How to fix) Fix [Bug]: Helm chart migrations-job.yaml doesn't URL-encode PostgreSQL password [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#24331Fetched 2026-04-08 01:13:16
View on GitHub
Comments
0
Participants
1
Timeline
1
Reactions
0
Author
Participants
Timeline (top)
labeled ×1

Error Message

Error: P1013: The provided database string is invalid. invalid port number in database URL.

Root Cause

  1. Set a base64-encoded password in postgresql.auth.password (e.g. IdS4Ahqw4rpvBgP8q/BK/A==) — base64 commonly contains /, +, and =
  2. Deploy with migrationJob.enabled: true (default)
  3. The migration job gets DATABASE_URL=postgresql://litellm:IdS4Ahqw4rpvBgP8q/BK/A==@release-postgresql/litellm
  4. Prisma fails to parse the URL because / is interpreted as a path separator

Code Example

Error: P1013: The provided database string is invalid. invalid port number in database URL.

---

value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Release.Name }}-postgresql/{{ .Values.postgresql.auth.database }}

---

prisma:warn Prisma doesn't know which engines to download for the Linux distro "wolfi"...
Error: P1013: The provided database string is invalid. invalid port number in database URL.
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I checked existing issues and this bug has not been reported yet.

What happened?

The migrations-job.yaml template constructs DATABASE_URL by directly interpolating postgresql.auth.password into the URL without URL-encoding. Passwords containing URL-special characters (/, +, =) cause the migration job to fail with Prisma error P1013:

Error: P1013: The provided database string is invalid. invalid port number in database URL.

Expected behavior: The migration job should handle passwords with special characters the same way the main deployment does.

Steps to Reproduce

  1. Set a base64-encoded password in postgresql.auth.password (e.g. IdS4Ahqw4rpvBgP8q/BK/A==) — base64 commonly contains /, +, and =
  2. Deploy with migrationJob.enabled: true (default)
  3. The migration job gets DATABASE_URL=postgresql://litellm:IdS4Ahqw4rpvBgP8q/BK/A==@release-postgresql/litellm
  4. Prisma fails to parse the URL because / is interpreted as a path separator

The main deployment is unaffected because it passes individual env vars (DATABASE_HOST, DATABASE_PASSWORD) and LiteLLM's Python code URL-encodes the password via urllib.parse.quote_plus() in construct_database_url_from_env_vars(). The migration job bypasses this Python logic.

The issue is in templates/migrations-job.yaml line 77:

value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password }}@{{ .Release.Name }}-postgresql/{{ .Values.postgresql.auth.database }}

Relevant log output

prisma:warn Prisma doesn't know which engines to download for the Linux distro "wolfi"...
Error: P1013: The provided database string is invalid. invalid port number in database URL.

What part of LiteLLM is this about?

Proxy

LiteLLM version

v1.82.3-stable

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

To resolve the issue, we need to URL-encode the password in the migrations-job.yaml template. We can use the urlencode function in Helm to achieve this.

Step-by-Step Solution

  • Update the migrations-job.yaml template to use the urlencode function:
value: postgresql://{{ .Values.postgresql.auth.username }}:{{ .Values.postgresql.auth.password | urlencode }}@{{ .Release.Name }}-postgresql/{{ .Values.postgresql.auth.database }}
  • No additional code changes are required.

Verification

  • Deploy the updated migrations-job.yaml template with migrationJob.enabled: true.
  • Verify that the migration job completes successfully without any Prisma errors.
  • Check the DATABASE_URL environment variable in the migration job to ensure that the password is properly URL-encoded.

Extra Tips

  • Make sure to test the updated template with different password values, including those containing special characters (/, +, =).
  • Consider adding a test case to ensure that the urlencode function is working correctly in the migrations-job.yaml template.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING