litellm icon indicating copy to clipboard operation
litellm copied to clipboard

[Bug]: Authentication Error, User not found, passed user_id=default_user_id

Open matejmajzel opened this issue 10 months ago • 18 comments

What happened?

Hi, I'm running the app with the docker-dompose which I updated a bit - changed the port of the app and also I created a .env file with the following: LITELLM_MASTER_KEY="sk-123" LITELLM_SALT_KEY="sk-123"

The app loads up ok but once I try to log in with admin and master key I get: Authentication Error, User not found, passed user_id=default_user_id

I've tried also running the postman /user/list and found nothing.

Relevant log output


Are you a ML Ops Team?

No

What LiteLLM version are you on ?

latest

Twitter / LinkedIn details

No response

matejmajzel avatar Mar 14 '25 12:03 matejmajzel

Same here! I've set the keys correctly in the .env file and can verify they are loaded using "docker-compose exec litellm env | grep MASTER_KEY". Still I keep getting "{"error":{"message":"Invalid credentials used to access UI.\nCheck 'UI_USERNAME', 'UI_PASSWORD' in .env file","type":"auth_error","param":"invalid_credentials","code":"401"}}"

captain-nemo avatar Mar 14 '25 13:03 captain-nemo

Getting the same here...

CoachTacamo avatar Mar 14 '25 14:03 CoachTacamo

Same here. When you check the container it also says unhealthy but cannot fix.

cccbb-cabae avatar Mar 14 '25 14:03 cccbb-cabae

Same here. I had to go back to a previous nightly build.

thadius83 avatar Mar 14 '25 15:03 thadius83

Same for me. Followed Networkchuck instructions in this video https://www.youtube.com/watch?v=nQCOTzS5oU0

Paddy3D avatar Mar 14 '25 17:03 Paddy3D

Same here. I had to go back to a previous nightly build.

which one works for you?

matejmajzel avatar Mar 14 '25 17:03 matejmajzel

Guys,

I found that using the latest stable tag worked well. I used Portainer to deleted any storage, images, containers related to LiteLLM and then re cloned the repo and targeted the stable tag. Compose Up and it's running smoothly.

callen5914 avatar Mar 14 '25 17:03 callen5914

Having the same issue. Last Stable tagged build (litellm_stable_release_branch-v1.61.3-stable) did not work. I have also tried. main-v1.63.7-nightly main-stable

RDGladden avatar Mar 14 '25 23:03 RDGladden

This worked for me (I use litellm:v1.63.8-stable as stated in the litellm/docker-compose.yml): Problem is the admin user not being correctly setup. Make sure your .env file contains the following (please set your own keys):

LITELLM_MASTER_KEY="sk-1234" LITELLM_SALT_KEY="your_random_salt_key" UI_USERNAME=admin UI_PASSWORD=sk-1234 PROXY_ADMIN_ID=admin

Make sure to restart LiteLLM with:

docker-compose down docker-compose up -d

Then create the admin user manually with the following (don't forget to replace sk-1234, [email protected], admin below with your own):

curl --location 'http://localhost:4000/user/new' --header 'Authorization: Bearer sk-1234' --header 'Content-Type: application/json' --data-raw '{"user_email": "[email protected]", "user_id": "admin"}'

I was able to login with my user and password as set in the .env file (i.e., admin and sk-1234 above). You can change details for your admin user via "Internal Users" on the UI.

Special thanks to NetworkChuck

MertSaka avatar Mar 15 '25 01:03 MertSaka

This worked for me (I use litellm:v1.63.8-stable as stated in the litellm/docker-compose.yml): Problem is the admin user not being correctly setup. Make sure your .env file contains the following (please set your own keys):

LITELLM_MASTER_KEY="sk-1234" LITELLM_SALT_KEY="your_random_salt_key" UI_USERNAME=admin UI_PASSWORD=sk-1234 PROXY_ADMIN_ID=admin

Make sure to restart LiteLLM with:

docker-compose down docker-compose up -d

Then create the admin user manually with the following (don't forget to replace sk-1234, [email protected], admin below with your own):

curl --location 'http://localhost:4000/user/new' --header 'Authorization: Bearer sk-1234' --header 'Content-Type: application/json' --data-raw '{"user_email": "[email protected]", "user_id": "admin"}'

I was able to login with my user and password as set in the .env file (i.e., admin and sk-1234 above). You can change details for your admin user via "Internal Users" on the UI.

Special thanks to NetworkChuck

Or just use a previous build which works well until this bug is solved

I used ghcr.io/berriai/litellm-database:main-v1.63.6-nightly in the docker-compose file which worked for me.

thadius83 avatar Mar 15 '25 03:03 thadius83

Having the same issue. Last Stable tagged build (litellm_stable_release_branch-v1.61.3-stable) did not work. I have also tried. main-v1.63.7-nightly main-stable

I used ghcr.io/berriai/litellm-database:main-v1.63.6-nightly in the docker-compose file which worked for me.

thadius83 avatar Mar 15 '25 03:03 thadius83

curl --location 'http://localhost:4000/user/new' --header 'Authorization: Bearer sk-1234' --header 'Content-Type: application/json' --data-raw '{"user_email": "[email protected]", "user_id": "admin"}'

This was the only solution that made it work for me!

captain-nemo avatar Mar 15 '25 12:03 captain-nemo

I downloaded the previous nights release. At first it resulted in the same error. I then cleared everything out relating to litellm then did a compose and this time the previous nights release I'd downloaded worked fine.

On Sat, 15 Mar 2025, 03:21 thadius83, @.***> wrote:

Having the same issue. Last Stable tagged build (litellm_stable_release_branch-v1.61.3-stable) did not work. I have also tried. main-v1.63.7-nightly main-stable

I used ghcr.io/berriai/litellm-database:main-v1.63.6-nightly in the docker-compose file which worked for me.

— Reply to this email directly, view it on GitHub https://github.com/BerriAI/litellm/issues/9243#issuecomment-2726168223, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATM5F2775OINHTE64EFY4F32UOMCPAVCNFSM6AAAAABZASX3ICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRWGE3DQMRSGM . You are receiving this because you commented.Message ID: @.***> [image: thadius83]thadius83 left a comment (BerriAI/litellm#9243) https://github.com/BerriAI/litellm/issues/9243#issuecomment-2726168223

Having the same issue. Last Stable tagged build (litellm_stable_release_branch-v1.61.3-stable) did not work. I have also tried. main-v1.63.7-nightly main-stable

I used ghcr.io/berriai/litellm-database:main-v1.63.6-nightly in the docker-compose file which worked for me.

— Reply to this email directly, view it on GitHub https://github.com/BerriAI/litellm/issues/9243#issuecomment-2726168223, or unsubscribe https://github.com/notifications/unsubscribe-auth/ATM5F2775OINHTE64EFY4F32UOMCPAVCNFSM6AAAAABZASX3ICVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOMRWGE3DQMRSGM . You are receiving this because you commented.Message ID: @.***>

Paddy3D avatar Mar 15 '25 12:03 Paddy3D

This worked for me (I use litellm:v1.63.8-stable as stated in the litellm/docker-compose.yml): Problem is the admin user not being correctly setup. Make sure your .env file contains the following (please set your own keys):

LITELLM_MASTER_KEY="sk-1234" LITELLM_SALT_KEY="your_random_salt_key" UI_USERNAME=admin UI_PASSWORD=sk-1234 PROXY_ADMIN_ID=admin

Make sure to restart LiteLLM with:

docker-compose down docker-compose up -d

Then create the admin user manually with the following (don't forget to replace sk-1234, [email protected], admin below with your own):

curl --location 'http://localhost:4000/user/new' --header 'Authorization: Bearer sk-1234' --header 'Content-Type: application/json' --data-raw '{"user_email": "[email protected]", "user_id": "admin"}'

I was able to login with my user and password as set in the .env file (i.e., admin and sk-1234 above). You can change details for your admin user via "Internal Users" on the UI.

Special thanks to NetworkChuck

thank you so much, I was stuck on it for hours

Akash037 avatar Mar 15 '25 13:03 Akash037

Update: LiteLLM Authentication Issue Resolved Good news! I've successfully resolved the authentication issues and can now login to the LiteLLM UI. Here's what worked:

Solution Summary Used the specific image: ghcr.io/berriai/litellm-database:main-v1.63.6-nightly in docker-compose.yml Kept working on the stable-1.63.2 branch Updated the .env file with proper configuration Created the admin user manually via curl Signed in with username "admin" and password "sk-1234" (the UI_PASSWORD value)

Detailed Steps Updated docker-compose.yml image: ghcr.io/berriai/litellm-database:main-v1.63.6-nightly

Updated .env file LITELLM_MASTER_KEY="sk-1234" (edited) LITELLM_SALT_KEY="your_random_salt_key" (edited) UI_USERNAME=admin UI_PASSWORD=sk-1234 (edited) PROXY_ADMIN_ID=admin

Created admin user manually curl --location 'http://localhost:4000/user/new'
--header 'Authorization: Bearer sk-1234'
--header 'Content-Type: application/json'
--data-raw '{"user_email": "[email protected]", "user_id": "admin"}'

Key Learnings The default setup doesn't automatically create the admin user The PROXY_ADMIN_ID environment variable was essential Using the nightly build of the database image was necessary for stability I needed to use the UI_PASSWORD value for login, not the LITELLM_MASTER_KEY

joblas avatar Mar 15 '25 18:03 joblas

I found we're having this error (https://github.com/Build5Nines/azd-litellm/issues/2) when deploying the latest release of LiteLLM, and we're using the litellm pip package for deployment. It seems for now, instead of pulling down the latest release, I need to explicitly specify version 1.63.8 and it all works fine. This seems to be the most recent version from before this bug was introduced.

crpietschmann avatar Mar 16 '25 14:03 crpietschmann

Workaround: execute /user/new endpoint mentioned in swagger

  1. Add your master_key in the padlock (on the right side)
  2. Run API with following body
{
  "user_id": "default_user_id",
  "user_role": "proxy_admin",
  "send_invite_email": false
}

Now you will be able to login.

Here is curl command:

curl -X 'POST' \
  'http://litelm:4000/user/new' \
  -H 'accept: application/json' \
  -H 'Ocp-Apim-Subscription-Key: sk-MjW3!7Mfr8Mgamu&' \
  -H 'Content-Type: application/json' \
  -d '{
  "user_id": "default_user_id",
  "user_role": "proxy_admin",
  "send_invite_email": false
}'

ankur198 avatar Mar 16 '25 20:03 ankur198

Is this fixed in 1.63.11 ? I wanted to setup my Ollama + LiteLLM server at hostinger after I've watched networkchuks video on youtube.

barrynorman avatar Mar 16 '25 20:03 barrynorman