amazon-q-developer-cli icon indicating copy to clipboard operation
amazon-q-developer-cli copied to clipboard

Error { code: "AccessDeniedException", message: "The bearer token included in the request is invalid.", aws_request_id: "xxxx" }

Open samkit777 opened this issue 4 months ago • 5 comments

Checks

Operating system

macOS 15.5.0 (24F74)

Expected behaviour

Q chat working without any issues.

Actual behaviour

Amazon Q is having trouble responding right now: 0: Failed to send the request: unhandled error (AccessDeniedException) 1: unhandled error (AccessDeniedException) 2: service error 3: unhandled error (AccessDeniedException) 4: Error { code: "AccessDeniedException", message: "The bearer token included in the request is invalid.", aws_request_id: "c4e447a8-a998-4352-add3-7b2515ce208d" }

Location: crates/chat-cli/src/cli/chat/mod.rs:1081

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it. Run with RUST_BACKTRACE=full to include source snippets.

Steps to reproduce

Q chat. Enter any prompt. Receive Error.

Environment

<This will be visible to anyone. Do not include personal or sensitive information>

[q-details]
version = "1.17.1"
hash = "52301a3b0f81abff5ecde04a02481734c5c7ecc4"
date = "2025-09-30T22:25:33.521557Z (3d ago)"
variant = "full"

[system-info]
os = "macOS 15.5.0 (24F74)"
chip = "Apple M1 Pro"
total-cores = 10
memory = "32.00 GB"

[environment]
cwd = "/Users/USER"
cli-path = "/Users/USER"
os = "Mac"
shell-path = "/bin/zsh"
shell-version = "5.9"
terminal = "macOS"
install-method = "unknown"

[env-vars]
PATH = "/Users/USER/.toolbox/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Users/USER/.local/bin"
QTERM_SESSION_ID = "425fbb32cc2d49aead2218d10adca57d"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.17.1"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "com.apple.Terminal"

samkit777 avatar Oct 03 '25 17:10 samkit777

Having the same issue

mcraeian avatar Oct 08 '25 12:10 mcraeian

Same here It's so annoying. Why does it happen even though I subscribe Pro?

kentaro-a avatar Oct 10 '25 00:10 kentaro-a

same error but on ubuntu. amazon q extension version - 1.103.0 2025-11-06 vscode version - 1.105.1

Authentication via browser is sucessful.

prateekjainaa avatar Nov 14 '25 17:11 prateekjainaa

Hi Everyone, it's been a while since I resolved this issue. Turned out, I was logged into Q portal using different account than what was previously setup with access. QCLI did not have any clear identifier for me to troubleshoot quickly. I recommend you to check the account that you're logging in Q developer with. This issue can happen if you have switched between accounts like I did in my situation.

samkit777 avatar Nov 14 '25 17:11 samkit777

my

In my case, uninstall (amz q) -> restart (vs code) -> install (amz q) -> restart (vs code). This worked for me.

prateekjainaa avatar Nov 15 '25 16:11 prateekjainaa