litellm - ✅(Solved) Fix [Bug]: Can't login despite setting password [1 pull requests, 2 comments, 2 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#23451Fetched 2026-04-08 00:44:12
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Author
Participants
Timeline (top)
commented ×2labeled ×2cross-referenced ×1

Error Message

litellm | 14:31:10 - LiteLLM Proxy:ERROR: internal_user_endpoints.py:1094 - litellm.proxy.proxy_server.user_update(): Exception occured - Not connected to DB! litellm | Traceback (most recent call last): litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 1088, in user_update litellm | response = await _update_single_user_helper( litellm | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ litellm | ...<2 lines>... litellm | ) litellm | ^ litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 880, in _update_single_user_helper litellm | raise Exception("Not connected to DB!") litellm | Exception: Not connected to DB! litellm | 14:31:10 - LiteLLM Proxy:ERROR: proxy_server.py:10388 - litellm.proxy.proxy_server.login_v2(): Exception occurred - litellm | Traceback (most recent call last): litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 1088, in user_update litellm | response = await _update_single_user_helper( litellm | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ litellm | ...<2 lines>... litellm | ) litellm | ^ litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 880, in _update_single_user_helper litellm | raise Exception("Not connected to DB!") litellm | Exception: Not connected to DB! litellm | litellm | During handling of the above exception, another exception occurred: litellm | litellm | Traceback (most recent call last): litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 10353, in login_v2 litellm | login_result = await authenticate_user( litellm | ^^^^^^^^^^^^^^^^^^^^^^^^ litellm | ...<4 lines>... litellm | ) litellm | ^ litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/login_utils.py", line 166, in authenticate_user litellm | await user_update( litellm | ...<7 lines>... litellm | ) litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/management_helpers/utils.py", line 455, in wrapper litellm | raise e litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/management_helpers/utils.py", line 371, in wrapper litellm | result = await func(*args, **kwargs) litellm | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 1109, in user_update litellm | raise ProxyException( litellm | ...<4 lines>... litellm | ) litellm | litellm.proxy._types.ProxyException litellm | INFO: 10.0.3.163:47046 - "POST /v2/login HTTP/1.1" 400 Bad Request litellm | 14:31:22 - LiteLLM Proxy:ERROR: proxy_server.py:10388 - litellm.proxy.proxy_server.login_v2(): Exception occurred - litellm | Traceback (most recent call last): litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 10353, in login_v2 litellm | login_result = await authenticate_user( litellm | ^^^^^^^^^^^^^^^^^^^^^^^^ litellm | ...<4 lines>... litellm | ) litellm | ^ litellm | File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/login_utils.py", line 302, in authenticate_user litellm | raise ProxyException( litellm | ...<4 lines>... litellm | ) litellm | litellm.proxy._types.ProxyException

Fix Action

Fixed

PR fix notes

PR #23456: Fix: allow UI login without database when DATABASE_URL is not set

Description (problem / solution / changelog)

Relevant issues

Fixes #23451

<!-- e.g. "Fixes #000" -->

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🐛 Bug Fix

<!-- Select the type of Pull Request --> <!-- Keep only the necessary ones -->

Changes

Fixes a bug where LiteLLM UI login fails when DATABASE_URL is not configured. Previously, login using UI_USERNAME and UI_PASSWORD required a database and raised an error if DATABASE_URL was not set. This change adds a fallback for local deployments by generating a temporary session key when no database is configured, allowing UI login without PostgreSQL. Testing: Manually tested login with UI_USERNAME and UI_PASSWORD without DATABASE_URL.

Changed files

  • litellm/proxy/auth/login_utils.py (modified, +8/-5)

Code Example

services:
  litellm:
    image: ghcr.io/berriai/litellm:main-stable
    container_name: litellm
    ports:
      - '4400:4000'
    dns:  # ← Add explicit DNS servers
      - 8.8.8.8
      - 1.1.1.1
    env_file:
      - .env
    environment:
      - DEEPINFRA_API_KEY=${DEEPINFRA_API_KEY}
      - LITELLM_MASTER_KEY=sk-1234
      - MASTER_KEY=admin
      - LITELLM_LOG=INFO
      - UI_USERNAME=admin
      - UI_PASSWORD=admin
    volumes:
      - ./config.yaml:/app/config.yaml:ro
    command: ['--config', '/app/config.yaml', '--port', '4000']

---

litellm  | 14:31:10 - LiteLLM Proxy:ERROR: internal_user_endpoints.py:1094 - litellm.proxy.proxy_server.user_update(): Exception occured - Not connected to DB!
litellm  | Traceback (most recent call last):
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 1088, in user_update
litellm  |     response = await _update_single_user_helper(
litellm  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |     ...<2 lines>...
litellm  |     )
litellm  |     ^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 880, in _update_single_user_helper
litellm  |     raise Exception("Not connected to DB!")
litellm  | Exception: Not connected to DB!
litellm  | 14:31:10 - LiteLLM Proxy:ERROR: proxy_server.py:10388 - litellm.proxy.proxy_server.login_v2(): Exception occurred -
litellm  | Traceback (most recent call last):
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 1088, in user_update
litellm  |     response = await _update_single_user_helper(
litellm  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |     ...<2 lines>...
litellm  |     )
litellm  |     ^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 880, in _update_single_user_helper
litellm  |     raise Exception("Not connected to DB!")
litellm  | Exception: Not connected to DB!
litellm  |
litellm  | During handling of the above exception, another exception occurred:
litellm  |
litellm  | Traceback (most recent call last):
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 10353, in login_v2
litellm  |     login_result = await authenticate_user(
litellm  |                    ^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |     ...<4 lines>...
litellm  |     )
litellm  |     ^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/login_utils.py", line 166, in authenticate_user
litellm  |     await user_update(
litellm  |     ...<7 lines>...
litellm  |     )
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_helpers/utils.py", line 455, in wrapper
litellm  |     raise e
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_helpers/utils.py", line 371, in wrapper
litellm  |     result = await func(*args, **kwargs)
litellm  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 1109, in user_update
litellm  |     raise ProxyException(
litellm  |     ...<4 lines>...
litellm  |     )
litellm  | litellm.proxy._types.ProxyException
litellm  | INFO:     10.0.3.163:47046 - "POST /v2/login HTTP/1.1" 400 Bad Request
litellm  | 14:31:22 - LiteLLM Proxy:ERROR: proxy_server.py:10388 - litellm.proxy.proxy_server.login_v2(): Exception occurred -
litellm  | Traceback (most recent call last):
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 10353, in login_v2
litellm  |     login_result = await authenticate_user(
litellm  |                    ^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |     ...<4 lines>...
litellm  |     )
litellm  |     ^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/login_utils.py", line 302, in authenticate_user
litellm  |     raise ProxyException(
litellm  |     ...<4 lines>...
litellm  |     )
litellm  | litellm.proxy._types.ProxyException
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

I am setting the environment variables for the password but the UI simply doesn't allow me to login. Not with admin not with sk-1234 not with anything.

I'm using whatever it is that's in the docker image (ghcr.io/berriai/litellm:main-stable)

As an aside, please provide an option to not have a login at all. I get it from a security point of view, fine. But i'm running this is a local environment on a local pc. It really makes no sense to have a login in that case. Which i'd argue is a high percentage of your users too.

Steps to Reproduce

My docker-compose:

services:
  litellm:
    image: ghcr.io/berriai/litellm:main-stable
    container_name: litellm
    ports:
      - '4400:4000'
    dns:  # ← Add explicit DNS servers
      - 8.8.8.8
      - 1.1.1.1
    env_file:
      - .env
    environment:
      - DEEPINFRA_API_KEY=${DEEPINFRA_API_KEY}
      - LITELLM_MASTER_KEY=sk-1234
      - MASTER_KEY=admin
      - LITELLM_LOG=INFO
      - UI_USERNAME=admin
      - UI_PASSWORD=admin
    volumes:
      - ./config.yaml:/app/config.yaml:ro
    command: ['--config', '/app/config.yaml', '--port', '4000']

Relevant log output

litellm  | 14:31:10 - LiteLLM Proxy:ERROR: internal_user_endpoints.py:1094 - litellm.proxy.proxy_server.user_update(): Exception occured - Not connected to DB!
litellm  | Traceback (most recent call last):
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 1088, in user_update
litellm  |     response = await _update_single_user_helper(
litellm  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |     ...<2 lines>...
litellm  |     )
litellm  |     ^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 880, in _update_single_user_helper
litellm  |     raise Exception("Not connected to DB!")
litellm  | Exception: Not connected to DB!
litellm  | 14:31:10 - LiteLLM Proxy:ERROR: proxy_server.py:10388 - litellm.proxy.proxy_server.login_v2(): Exception occurred -
litellm  | Traceback (most recent call last):
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 1088, in user_update
litellm  |     response = await _update_single_user_helper(
litellm  |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |     ...<2 lines>...
litellm  |     )
litellm  |     ^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 880, in _update_single_user_helper
litellm  |     raise Exception("Not connected to DB!")
litellm  | Exception: Not connected to DB!
litellm  |
litellm  | During handling of the above exception, another exception occurred:
litellm  |
litellm  | Traceback (most recent call last):
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 10353, in login_v2
litellm  |     login_result = await authenticate_user(
litellm  |                    ^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |     ...<4 lines>...
litellm  |     )
litellm  |     ^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/login_utils.py", line 166, in authenticate_user
litellm  |     await user_update(
litellm  |     ...<7 lines>...
litellm  |     )
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_helpers/utils.py", line 455, in wrapper
litellm  |     raise e
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_helpers/utils.py", line 371, in wrapper
litellm  |     result = await func(*args, **kwargs)
litellm  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/management_endpoints/internal_user_endpoints.py", line 1109, in user_update
litellm  |     raise ProxyException(
litellm  |     ...<4 lines>...
litellm  |     )
litellm  | litellm.proxy._types.ProxyException
litellm  | INFO:     10.0.3.163:47046 - "POST /v2/login HTTP/1.1" 400 Bad Request
litellm  | 14:31:22 - LiteLLM Proxy:ERROR: proxy_server.py:10388 - litellm.proxy.proxy_server.login_v2(): Exception occurred -
litellm  | Traceback (most recent call last):
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/proxy_server.py", line 10353, in login_v2
litellm  |     login_result = await authenticate_user(
litellm  |                    ^^^^^^^^^^^^^^^^^^^^^^^^
litellm  |     ...<4 lines>...
litellm  |     )
litellm  |     ^
litellm  |   File "/usr/lib/python3.13/site-packages/litellm/proxy/auth/login_utils.py", line 302, in authenticate_user
litellm  |     raise ProxyException(
litellm  |     ...<4 lines>...
litellm  |     )
litellm  | litellm.proxy._types.ProxyException

What part of LiteLLM is this about?

UI Dashboard

What LiteLLM version are you on ?

vx.x.xxx (The UI doesn't say, the logging doesn't say, the pull doesn't say.. How am i even supposed to know if nothing tells me it's version. Probably the latest at the time of this posting.

Twitter / LinkedIn details

No response

extent analysis

Fix Plan

The issue seems to be related to the environment variables not being set correctly for the UI login.

To fix this, you need to ensure that the LITELLM_MASTER_KEY and MASTER_KEY environment variables are set correctly in your docker-compose.yml file.

Here are the steps to follow:

  • Remove the MASTER_KEY environment variable from your docker-compose.yml file, as it seems to be deprecated.
  • Ensure that the LITELLM_MASTER_KEY environment variable is set to the correct value, which in your case is sk-1234.
  • Also, make sure that the UI_USERNAME and UI_PASSWORD environment variables are set to the correct values.

Here's an example of how your docker-compose.yml file should look:

services:
  litellm:
    image: ghcr.io/berriai/litellm:main-stable
    container_name: litellm
    ports:
      - '4400:4000'
    dns: 
      - 8.8.8.8
      - 1.1.1.1
    env_file:
      - .env
    environment:
      - DEEPINFRA_API_KEY=${DEEPINFRA_API_KEY}
      - LITELLM_MASTER_KEY=sk-1234
      - UI_USERNAME=admin
      - UI_PASSWORD=admin
      - LITELLM_LOG=INFO
    volumes:
      - ./config.yaml:/app/config.yaml:ro
    command: ['--config', '/app/config.yaml', '--port', '4000']

Verification

To verify that the fix worked, try logging in to the UI dashboard with the username admin and password admin. If you are still unable to log in, check the logs for any error messages that may indicate what's going wrong.

Extra Tips

  • Make sure to check the LiteLLM documentation for any specific requirements for setting environment variables.
  • If you are still having issues, try checking the version of LiteLLM you are running by checking the Docker image version or by contacting the LiteLLM support team.

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