agent-orchestrator icon indicating copy to clipboard operation
agent-orchestrator copied to clipboard

Claude Code model picker: "no credential could be resolved for this provider" while the Claude CLI is signed in

Open prasann16 opened this issue 4 weeks ago • 3 comments

In the New Task composer for project myreadr, with Claude Code selected as the agent, the model picker can't load models. The picker and the area under the composer both show:

Couldn't load Claude Code's models: claude-code model discovery: claude-code: model discovery: no credential could be resolved for this provider

Retry is offered. Claude Code is signed in on this machine. The reporter shared screenshots in chat; they aren't attached here.


Agent-collected evidence

Collected 2026-11-03 ~12:55 UTC on the reporter's machine with read-only checks.

  • AO app/daemon 0.14.9-nightly.202611030413, commit 2895333c5d7e. macOS 15.7.9, x86_64.
  • Claude Code 2.1.317. claude auth status → loggedIn: true, authMethod: claude.ai, apiProvider: firstParty, subscriptionType: team. A Claude Code-credentials keychain item exists. No ANTHROPIC_* variables are set in the shell.
  • So the Claude CLI reports a valid login while AO's discovery says no credential could be resolved. I didn't check how the daemon resolves the credential (keychain access from the daemon process, or the environment it inherits).
  • The same session also hit #6621 (Intel Mac bundled-Node crash). I don't know whether the two are related.
  • Duplicate search in OrchestratorInc/agent-orchestrator for "no credential could be resolved" and "claude-code model discovery": closest is #6658 (an expired-token message, different) and the doubled prefix is #7205. I found no exact match.

prasann16 avatar Nov 03 '26 12:11 prasann16

Agent-collected evidence (follow-up)

Collected 2026-11-03 ~13:00–13:15 UTC on the reporter's machine with read-only checks. Source citations are from a checkout of 2895333c5d7e, which matches the installed daemon (ao version 0.14.9-nightly.202611030413 commit 2895333c5d7e).

1. The daemon resolves an old Claude CLI

The daemon process's PATH is /usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin. That list doesn't include ~/.local/bin, where the user's current CLI lives.

Path Version
~/.local/bin/claude → ~/.local/share/claude/versions/2.1.317 2.1.317 (the one the user runs)
/usr/local/bin/claude → /usr/local/Caskroom/claude-code/2.0.28/claude 2.0.28 (stale Homebrew cask from Nov 2025)

The cached catalog row shows the daemon uses the old one:

$ sqlite3 -readonly ~/.ao/data/ao.db "select agent_id, project_id, source, fetched_at, last_success_at, refresh_state, refresh_error, retry_count, metadata_json from agent_model_catalog where agent_id like 'claude%'"
claude-code||manual|2026-11-03 12:49:38 UTC||error|claude-code model discovery: claude-code: model discovery: no credential could be resolved for this provider|3|{"binary":"/usr/local/bin/claude","scope":"project"}

last_success_at is empty, so discovery has never succeeded on this install. ~/.ao/data/harnesses/bin holds only a managed codex, with no managed claude. binaryutil.ResolveBinary (internal/adapters/agent/binaryutil/binaryutil.go:86) returns the first exec.LookPath hit. claudeBinarySpec has no ValidateIdentity/version check, so 2.0.28 is accepted.

2. claude auth status on 2.0.28 is not a subcommand

On 2.0.28 the words are treated as a prompt and sent to the API, and the call runs until it fails:

$ /usr/local/bin/claude auth status
API Error: 404 {"type":"error","error":{"type":"not_found_error","message":"model: claude-opus-4-1-20250805"},...}

$ env -i HOME=$HOME USER=$USER PATH=<daemon PATH> /usr/local/bin/claude auth status </dev/null   # cwd = project
rc=1 elapsed=25.79s

3. The credential itself is fine and readable

The same keychain read AO does (security find-generic-password -s "Claude Code-credentials" -w) returns rc=0 in 0.15s. The payload has claudeAiOauth.accessToken (prefix sk-ant-oat), a refresh token, expiresAt in the future, and subscriptionType: team. That is the format oauthTokenFromCredentialsJSON (pkg/agentcreds/resolve.go:255) parses. The "Claude Code" service is absent (rc=44), which is expected, and ~/.claude/.credentials.json doesn't exist. No ANTHROPIC_*, CLAUDE_CODE_OAUTH_TOKEN, or provider env vars are set in the daemon env, in ~/.claude/settings.json, or in the project's .claude/settings.local.json, which contains only permissions. So WorkspaceProviderRouting/DisableStoredCredentials doesn't apply, and the provider resolves to first-party.

4. Hypothesis (not confirmed by a daemon-side trace): the 2.0.28 auth probe uses up the shared deadline before the keychain read

In ProviderModels (internal/adapters/agent/claudecode/auth.go:604):

  1. probeCtx is created with agentcreds.DefaultTimeout = 3s.
  2. resolveProviderContext(probeCtx, …) first runs claudeCLIAuthReport, which runs claude auth status under a child timeout claudeAuthProbeTimeout = 3s. That's no extra time beyond the parent's 3s.
  3. Only then does it call agentcreds.ResolveLocal(ctx, …) → readKeychain. That derives its own 3s timeout from the same, by now expired, parent and returns "no credential" as soon as probeCtx.Err() != nil (pkg/agentcreds/keychain.go).

With 2.0.28, step 2 runs ~26s and is killed at 3s, which leaves no time for step 3. That would explain "no credential could be resolved" while the keychain item is valid and reads in 150 ms. I haven't verified this against the running daemon. It is consistent with the code path and the timings above.

Two things in the code would make this fail silently even once the root cause is fixed:

  • The keychain read shares a deadline with an external CLI call. A slow or hung claude auth status turns into "no credential" rather than "probe timed out".
  • No minimum version check or identity validation on the resolved claude. A stale binary earlier in the daemon's PATH takes precedence over the version the user actually runs.

The same resolved binary is presumably what the Chat ACP adapter gets as CLAUDE_CODE_EXECUTABLE. On this machine, though, #6621 (the bundled Node crash on Intel) fails first, so that path can't be checked here.

Not tried

I didn't remove or upgrade the stale /usr/local/bin/claude or restart the daemon, so it's still unconfirmed whether that clears the error.

prasann16 avatar Nov 03 '26 13:11 prasann16

Thanks for reporting, @prasann16. I tested New Task on latest main (a1fe965e70) on macOS. With Claude Code 2.0.28, Retry still says "no credential could be resolved for this provider" even though Claude is signed in. Models load with 2.1.318. Leaving this open. https://github.com/user-attachments/assets/e5264ad0-23bb-4679-9089-2978007bb614 Error screenshot | Models with current Claude

Rishet11 avatar Nov 04 '26 03:11 Rishet11

Still reproducible on main (1fc31db844, 2026-11-18). Fix is up in #8623.

The hypothesis in @prasann16's follow-up was right. ProviderModels (backend/internal/adapters/agent/claudecode/auth.go) ran the claude auth status probe, the keychain read and the provider request under one 3s deadline. The stale 2.0.28 CLI at /usr/local/bin/claude treats auth status as a prompt and used up all 3s. The keychain read then started with an expired context and returned nothing, which produced "no credential could be resolved". Settings wasn't affected because the auth-status check doesn't share that deadline. That's why it showed signed in while the picker failed.

#8623 gives the provider request its own deadline, started after the credential is resolved. It also adds a regression test, which fails on the old code and passes with the fix. With 2.0.28 still on PATH, models should now load after the probe's 3s timeout.

Workaround until it merges: remove or upgrade the stale Homebrew cask (brew uninstall --cask claude-code), or put ~/.local/bin ahead of /usr/local/bin in the daemon's PATH.

Still not handled: AO doesn't warn when an outdated claude binary earlier on PATH shadows the one you actually use.

nikhilachale avatar Nov 18 '26 04:11 nikhilachale