aws / aws/amazon-q-developer-cli
Title: TUI mode silently fails with misleading "no social token found" error (--legacy-ui works)
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
### Checks
- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again
### Operating system
Linux 5.14.0-570.28.1.el9_6.x86_64 - Rocky Linux 9.6 (Blue Onyx)
### Expected behaviour
## Description
`kiro-cli chat` (TUI mode) exits immediately with exit code 1, displaying misleading authentication error messages. The `--legacy-ui` mode works perfectly,
confirming that authentication and the chat engine are functioning correctly.
## Environment
- kiro-cli: 2.2.2
- OS: Rocky Linux 9.6
- Virtualization: KVM
- TERM: xterm
- TTY: /dev/pts/1
- Shell: bash
## Steps to Reproduce
1. `kiro-cli login --use-device-flow` → succeeds
2. `kiro-cli whoami` → shows correct user
3. `kiro-cli chat` → exits immediately
## Expected Behavior
TUI chat interface should start.
## Actual Behavior
$ kiro-cli chat -vv
2026-05-07T01:01:54.605520Z INFO q_cli::cli: 542: no social token found
2026-05-07T01:01:54.606142Z INFO q_cli::cli: 560: no idp token found
$ echo $?
1
## Workarounds (all work)
- `kiro-cli chat --legacy-ui` ✅
- `echo "hello" | kiro-cli chat` ✅ (pipe mode)
## Notes
- The error message "no social token found / no idp token found" is **misleading**. Authentication is verified working via `kiro-cli whoami` and `--legacy-ui` mode.
- The actual issue appears to be TUI initialization failure, with incorrect error reporting falling through to an auth check path.
- Tested with both root and non-root users — same result.
- Tested with `TERM=xterm-256color` — same result.
### Actual behaviour
```
$ kiro-cli chat -vv 2>&1; echo "exit: $?"
2026-05-07T01:01:54.605520Z INFO q_cli::cli: 542: no social token found
2026-05-07T01:01:54.606142Z INFO q_cli::cli: 560: no idp token found
exit: 1
$ kiro-cli chat --legacy-ui
(works normally - chat interface starts)
```
verified working via kiro-cli whoami
### Steps to reproduce
_No response_
### Environment
```yaml
[q-details]
version = "2.2.2"
hash = "7b8bf7d8e854fbf3b4071b047526b3dd851b2563"
date = "2026-05-05T23:02:24.043902Z (1d ago)"
variant = "minimal"
[system-info]
chip = "QEMU Virtual CPU version 2.5+"
total-cores = 2
memory = "23.22 GB"
[system-info.os.linux]
kernel_version = "5.14.0-570.28.1.el9_6.x86_64"
id = "rocky"
name = "Rocky Linux"
pretty_name = "Rocky Linux 9.6 (Blue Onyx)"
version_id = "9.6"
version = "9.6 (Blue Onyx)"
[environment]
cwd = "/USER"
cli-path = "/USER"
os = "Linux"
shell-path = "/usr/bin/bash"
install-method = "unknown"
in-ssh = true
[env-vars]
PATH = "/USER/.local/bin:/USER/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"
QTERM_SESSION_ID = "5d19a34b3ca34c658e3245f4baa561b8"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "2.2.2"
SHELL = "/bin/bash"
TERM = "xterm"
XDG_SESSION_TYPE = "tty"
```
Contributor guide
Assessment
This issue has not been assessed yet.