Skip to content

codemie assistants chat fails with misleading "Authentication expired" error despite valid, freshly-refreshed SSO session #499

Description

@yaoweikwek

Description

The codemie assistants chat command fails with a misleading "Authentication expired" error when chatting with any registered CodeMie assistant, even immediately after a fresh, successful SSO token refresh. The main coding LLM (chat/completions) works fine — only the assistants chat subcommand is affected.

Steps to Reproduce

  1. Have one or more assistants registered (e.g. via codemie assistants registration), tied to a CodeMie project.
  2. Run codemie profile refresh — this succeeds and confirms a valid SSO session (verified with codemie profile status, showing ~24h remaining).
  3. Run codemie assistants chat <assistant-id> "hello test".
  4. Observe the failure. Retrying immediately, with a different assistant ID, or in a clean environment (env -i) produces the identical error every time.

Expected Behavior

The assistant chat should succeed using the valid, freshly-refreshed SSO session — same as the main coding chat, which works without issue.

Actual Behavior

- Loading configuration...
✔ Connected to CodeMie

✗ undefined

❌ Authentication expired. Please re-authenticate.

This happens consistently, regardless of:

  • Refreshing the SSO token right before retrying (codemie profile refresh → immediate retry)
  • Which registered assistant ID is targeted (reproduced with two different assistants)
  • Running in a clean environment stripped of extra env vars

Additionally, the debug logs do not capture the real error detail — the underlying error object is logged as the literal string [object Object] instead of being serialized, so the true HTTP status/response body is lost:

[ERROR] [system] [] Assistant chat API call failed [object Object]
[ERROR] [system] [] Failed to chat with assistant [object Object]

This makes it impossible for users (or maintainers reviewing logs) to determine the real cause (e.g. a 403 permission issue vs. genuine auth expiry).

Environment

Field Value
OS Darwin 25.5.0 arm64
Node.js v24.5.0
npm 11.19.0
CodeMie CLI 0.14.0
Shell /bin/zsh
Terminal Apple_Terminal

Installed Agents

  • CodeMie Code (0.0.47)
  • Claude Code (2.1.218)
  • Claude Code ACP
  • Gemini CLI (0.55.1)
  • OpenCode CLI (1.18.18)

CodeMie Doctor Output

Full doctor output
🔍 CodeMie Code Health Check

- Checking Node.js...
Node.js:
  ✓ Version v24.5.0

- Checking npm...
npm:
  ✓ Version 11.19.0

- Checking Python...
Python:
  ✓ Version 3.14.7

- Checking uv...
uv:
  ○ uv not found

- Checking AWS CLI...
AWS CLI:
  ⚠ AWS CLI not found

- Checking Active Profile...
Active Profile:
  ○ Active Profile: default
  ✓ Provider: ai-run-sso
  ✓ CodeMie URL: https://codemie.lab.epam.com
  ✓ API Key: proxy-ha***dled
  ✓ Model: claude-sonnet-5

- Checking Provider...
CodeMie SSO Provider:
  ✓ Provider operational
  ✓ CodeMie URL: https://codemie.lab.epam.com
  ✓ SSO credentials stored
  ✓ Session expires in 24 hour(s)
  ✓ Model 'claude-sonnet-5' available

- Checking JWT Authentication...
JWT Authentication:
  ○ Not using JWT authentication (skipped)

Installed Agents:
- Checking CodeMie Code...
  ✓ CodeMie Code (0.0.47)
- Checking Claude Code...
  ✓ Claude Code (2.1.218)
- Checking Claude Code ACP...
  ✓ Claude Code ACP
- Checking Gemini CLI...
  ✓ Gemini CLI (0.55.1)
- Checking OpenCode CLI...
  ✓ OpenCode CLI (1.18.18)

- Checking Repository & Workflows...
Repository & Workflows:
  ○ Not a git repository

Frameworks:
- Checking SpecKit...
  ○ SpecKit - not installed
- Checking BMAD Method...
  ○ BMAD Method - not installed
- Checking Codebase Memory MCP...
  ○ Codebase Memory MCP - not installed

⚠ Some issues detected. Please resolve them for optimal performance.

Recent Errors

ERROR entries from recent logs
[2026-08-21T04:02:23.910Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-21T04:02:24.261Z] [ERROR] [system] [] Failed to chat with assistant [object Object]
[2026-08-21T04:02:52.143Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-21T04:02:52.475Z] [ERROR] [system] [] Failed to chat with assistant [object Object]
[2026-08-21T04:03:04.810Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-21T04:03:05.522Z] [ERROR] [system] [] Failed to chat with assistant [object Object]
[2026-08-21T04:03:19.844Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-21T04:03:20.296Z] [ERROR] [system] [] Failed to chat with assistant [object Object]

--- previous day (debug-2026-08-20.log) ---
[2026-08-20T02:15:19.164Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-20T02:15:19.416Z] [ERROR] [system] [] Failed to chat with assistant [object Object]
[2026-08-20T02:15:44.517Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-20T02:17:18.032Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-20T02:17:18.415Z] [ERROR] [system] [] Failed to chat with assistant [object Object]
[2026-08-20T02:17:35.107Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-20T02:17:35.360Z] [ERROR] [system] [] Failed to chat with assistant [object Object]
[2026-08-20T02:17:42.159Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-20T02:26:57.496Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-20T02:27:29.342Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-20T02:27:58.020Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-20T02:35:24.158Z] [ERROR] [system] [] Assistant chat API call failed [object Object]
[2026-08-20T08:03:22.930Z] [ERROR] [system] [] Assistant chat API call failed [object Object]

Full Debug Logs

Full debug logs (2026-08-20 and 2026-08-21) attached here: https://gist.github.com/yaoweikwek/f3f76994f1642f2d344e01e504834549

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions