lms icon indicating copy to clipboard operation
lms copied to clipboard

Failed to authenticate: Invalid passkey for lms CLI client

Open stewartoallen opened this issue 1 month ago • 4 comments

macOS 15.6.1 LM Studio 0.3.31 (Build 7)

lms cli no longer works. bootstrap says it's already installed and I eventually resorted to killing all lmstudio processes and blowing away the entire ~/.cache/lm-studio directory. this was rebuilt on re-start of lmstudio, but it still didn't fix the issue. here's the full trace.

oh, and I also re-logged in using lms login which brought up the browser and I was able to login using 2FA. I probably did this several times between the killing and cleaning and re-installing.

yes, lmstudio is running. and working.

code@studio build % lms chat
[LMStudioClient][LLM][ClientPort][WsClientTransport:AuthenticatedWsClientTransport] WebSocket error: Error: Failed to authenticate: Invalid passkey for lms CLI client. Please make sure you are using the lms shipped with LM Studio.
    at ws.addEventListener.once (./dist/index.js:72612:36)
    at callListener (./dist/index.js:9383:15)
    at WebSocket.onMessage (./dist/index.js:9302:10)
    at Object.onceWrapper (node:events:633:26)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (./dist/index.js:10812:21)
    at Receiver.emit (node:events:518:28)
    at ./dist/index.js:8468:17
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
[LMStudioClient][Repository][ClientPort][WsClientTransport:AuthenticatedWsClientTransport] WebSocket error: Error: Failed to authenticate: Invalid passkey for lms CLI client. Please make sure you are using the lms shipped with LM Studio.
    at ws.addEventListener.once (./dist/index.js:72612:36)
    at callListener (./dist/index.js:9383:15)
    at WebSocket.onMessage (./dist/index.js:9302:10)
    at Object.onceWrapper (node:events:633:26)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (./dist/index.js:10812:21)
    at Receiver.emit (node:events:518:28)
    at ./dist/index.js:8468:17
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
Error: Error fetching model catalog: Error: Failed to authenticate: Invalid passkey for lms CLI client. Please make sure you are using the lms shipped with LM Studio.
    at ws.addEventListener.once (./dist/index.js:72612:36)
    at callListener (./dist/index.js:9383:15)
    at WebSocket.onMessage (./dist/index.js:9302:10)
    at Object.onceWrapper (node:events:633:26)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (./dist/index.js:10812:21)
    at Receiver.emit (node:events:518:28)
    at ./dist/index.js:8468:17
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
[LMStudioClient][System][ClientPort][WsClientTransport:AuthenticatedWsClientTransport] WebSocket error: Error: Failed to authenticate: Invalid passkey for lms CLI client. Please make sure you are using the lms shipped with LM Studio.
    at ws.addEventListener.once (./dist/index.js:72612:36)
    at callListener (./dist/index.js:9383:15)
    at WebSocket.onMessage (./dist/index.js:9302:10)
    at Object.onceWrapper (node:events:633:26)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (./dist/index.js:10812:21)
    at Receiver.emit (node:events:518:28)
    at ./dist/index.js:8468:17
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
Error: Failed to authenticate: Invalid passkey for lms CLI client. Please make sure you are using the lms shipped with LM Studio.
    at ws.addEventListener.once (./dist/index.js:72612:36)
    at callListener (./dist/index.js:9383:15)
    at WebSocket.onMessage (./dist/index.js:9302:10)
    at Object.onceWrapper (node:events:633:26)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (./dist/index.js:10812:21)
    at Receiver.emit (node:events:518:28)
    at ./dist/index.js:8468:17
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)

stewartoallen avatar Nov 08 '25 12:11 stewartoallen


❯ lms version
   __   __  ___  ______          ___        _______   ____
  / /  /  |/  / / __/ /___ _____/ (_)__    / ___/ /  /  _/
 / /__/ /|_/ / _\ \/ __/ // / _  / / _ \  / /__/ /___/ /
/____/_/  /_/ /___/\__/\_,_/\_,_/_/\___/  \___/____/___/

lms - LM Studio CLI - v0.0.47
GitHub: https://github.com/lmstudio-ai/lms


❯ lms status
[LMStudioClient][LLM][ClientPort][WsClientTransport:AuthenticatedWsClientTransport] WebSocket error: Error: Failed to authenticate: Invalid passkey for lms CLI client. Please make sure you are using the lms shipped with LM Studio.
    at ws.addEventListener.once (./dist/index.js:72612:36)
    at callListener (./dist/index.js:9383:15)
    at WebSocket.onMessage (./dist/index.js:9302:10)
    at Object.onceWrapper (node:events:633:26)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (./dist/index.js:10812:21)
    at Receiver.emit (node:events:518:28)
    at ./dist/index.js:8468:17
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
Error: Failed to authenticate: Invalid passkey for lms CLI client. Please make sure you are using the lms shipped with LM Studio.
    at ws.addEventListener.once (./dist/index.js:72612:36)
    at callListener (./dist/index.js:9383:15)
    at WebSocket.onMessage (./dist/index.js:9302:10)
    at Object.onceWrapper (node:events:633:26)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (./dist/index.js:10812:21)
    at Receiver.emit (node:events:518:28)
    at ./dist/index.js:8468:17
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)


❯ lms login
[LMStudioClient][Repository][ClientPort][WsClientTransport:AuthenticatedWsClientTransport] WebSocket error: Error: Failed to authenticate: Invalid passkey for lms CLI client. Please make sure you are using the lms shipped with LM Studio.
    at ws.addEventListener.once (./dist/index.js:72612:36)
    at callListener (./dist/index.js:9383:15)
    at WebSocket.onMessage (./dist/index.js:9302:10)
    at Object.onceWrapper (node:events:633:26)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (./dist/index.js:10812:21)
    at Receiver.emit (node:events:518:28)
    at ./dist/index.js:8468:17
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)
Error: Failed to authenticate: Invalid passkey for lms CLI client. Please make sure you are using the lms shipped with LM Studio.
    at ws.addEventListener.once (./dist/index.js:72612:36)
    at callListener (./dist/index.js:9383:15)
    at WebSocket.onMessage (./dist/index.js:9302:10)
    at Object.onceWrapper (node:events:633:26)
    at WebSocket.emit (node:events:518:28)
    at Receiver.receiverOnMessage (./dist/index.js:10812:21)
    at Receiver.emit (node:events:518:28)
    at ./dist/index.js:8468:17
    at node:internal/process/task_queues:140:7
    at AsyncResource.runInAsyncScope (node:async_hooks:206:9)

same here

kumanoko24 avatar Nov 08 '25 14:11 kumanoko24

this issue is firetrucking stupid.

just solved by re-installation.

@stewartoallen please try keeping only ~/.lmstudio/models and delete other things in ~/.lmstudio , including .internal things

❯ pwd
/Users/admin/.lmstudio

❯ ls -larh
total 24
drwxr-xr-x@  2 admin  staff    64B Nov  9 01:13 working-directories
drwxr-xr-x@  2 admin  staff    64B Nov  9 01:13 user-files
drwxr-xr-x@  3 admin  staff    96B Nov  9 01:13 server-logs
drwxr-xr-x   5 admin  staff   160B Nov  2 16:23 models
-rw-r--r--@  1 admin  staff    22B Nov  9 01:13 mcp.json
drwxr-xr-x@  4 admin  staff   128B Nov  9 01:13 hub
drwxr-xr-x@  5 admin  staff   160B Nov  9 01:13 extensions
drwxr-xr-x@  2 admin  staff    64B Nov  9 01:13 credentials
drwxr-xr-x@  3 admin  staff    96B Nov  9 01:13 conversations
drwxr-xr-x@  2 admin  staff    64B Nov  9 01:13 config-presets
drwxr-xr-x@  3 admin  staff    96B Nov  9 01:13 bin
drwxr-xr-x@ 28 admin  staff   896B Nov  9 01:14 .internal
-rw-r--r--@  1 admin  staff   6.0K Sep 30 18:40 .DS_Store
drwxr-x---+ 61 admin  staff   1.9K Nov  9 01:15 ..
drwxr-xr-x  15 admin  staff   480B Nov  9 01:13 .

and make sure lmstudio server/process/services are all closed, exited.

and re-download the lmstudio installer (for example, LM-Studio-0.3.31-7-arm64.dmg) and re-install, just overwrite the original installation.

and you can run lms ls after you open the lm studio again (mac will ask you about the "this application is from internet..." things).

kumanoko24 avatar Nov 08 '25 17:11 kumanoko24

very irritating issue, took me hours lol. this issue also blocks the lmstudio.js usages.

kumanoko24 avatar Nov 08 '25 17:11 kumanoko24

Same here:

Image

arty-hlr avatar Nov 14 '25 17:11 arty-hlr