Skip to content

401 Unauthorized when using cody chat CLI (completions are not enabled) #8202

@gilcleis

Description

@gilcleis

When using cody chat via CLI, I get a 401 Unauthorized error, even though I am successfully authenticated with cody auth login --web.

To Reproduce
Steps to reproduce the behavior:

$ cody auth login --web
✔ You are already logged in as usarname

$ cody chat -m "Tell me about React hooks"
🤜    🤛  Noxide Loader: Loading noxide library
DelegatingProxy: Loaded 156 CA certs from noxide

 ✖ Unexpected error: {
  "speaker": "assistant",
  "error": {
    "isChatErrorGuard": "isChatErrorGuard",
    "status": 401,
    "traceId": "f7bed5d4caa019dd5232b6de8632e43d",
    "message": "Request to https://sourcegraph.com/.api/completions/stream?api-version=9&client-name=jetbrains&client-version=5.5.21 failed with 401 Unauthorized: {\"message\":\"status 401, reason completions are not enabled\",\"type\":\"http_error\"}",
    "name": "Error"
  }
}

Expected behavior
Cody should return a response using the CLI chat command when authenticated.

System info:
OS: Ubuntu 22.04
Node.js: v20.19.4
npm: 10.8.2
Cody CLI: 5.5.21

Auth method: cody auth login --web (confirmed successful login)

Trace ID
f7bed5d4caa019dd5232b6de8632e43d

Additional context:

I’m using the global CLI via npm (@sourcegraph/cody)
I have tried re-authenticating and reinstalling the CLI
My account appears to be correctly logged in, but the completions feature may not be enabled for my plan

Let me know if you need any other information to help debug this issue. Thank you! 🙏

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions