Skip to content

hermes chat: 'No usable credentials' after successful login (0.6.3); only works with MUSE_CODE_SUB_TOKEN in .env #18

Closed

Description

@longdang22888

Summary

After a successful hermes auth add muse-code, hermes chat --provider muse-code -m muse-spark-1.3 -q ping fails with:

No usable credentials found for provider 'muse-code'. Set MUSE_CODE_SUB_TOKEN.

The login cache is valid, and hermes auth status muse-code reports logged in. Adding MUSE_CODE_SUB_TOKEN=<cached apiKey> to $HERMES_HOME/.env fixes it.

Environment

  • Plugin 0.6.3 (git bd32a4e), Hermes Agent v0.23.1 (2026.9.24), macOS 15.2 arm64
  • Launcher: ~/.hermes/hermes-agent/.hermes/bin/hermes
  • config.yaml: model.provider: muse-code, model.default: muse-spark-1.3, plugin enabled

Steps

  1. hermes auth add muse-code finishes. ~/.hermes/muse-code-sub.json exists with apiKey, accountId and email.
  2. hermes auth list shows muse-code #1 MUSE_CODE_SUB_TOKEN api_key env:MUSE_CODE_SUB_TOKEN.
  3. hermes chat -m muse-spark-1.3 --provider muse-code -q ping fails with the error above (runtime_provider.py:907, _api_key_provider_runtime). The same error appears in the desktop/gateway session. agent.log also logs credential pool muse-code: no available entries.

Observations

  • Exporting MUSE_CODE_SUB_TOKEN in the shell before hermes chat still fails.
  • The key is not in .env. _resolve_api_key_provider_secret reads get_env_value_prefer_dotenv(), which reads .env first and then os.environ. This looks like it misses the value that _ensure_subscription_key() exports.
  • Standalone, discover_plugins() followed by resolve_api_key_provider_credentials("muse-code") does return a key (source MUSE_CODE_SUB_TOKEN), so the plugin works when imported in that order. In the CLI/desktop runtime path it doesn't. I haven't found which step differs.
  • Workaround: write MUSE_CODE_SUB_TOKEN=<apiKey> into $HERMES_HOME/.env. Chat then works (pong). A later re-login makes .env stale, so the user would hit the 402 case in the README.

Suggestion

Override ProviderProfile.resolve_api_key_secret() (providers/base.py:628) in MuseCodeSubscriptionProfile to return (read_cached_key(), "muse-code-sub") when no explicit MUSE_CODE_SUB_TOKEN is set. That avoids relying on the process-env export.

Activity

  1. TheStreamCode commented on Nov 12, 2026

    @TheStreamCode
    Owner

    Fixed in 0.6.4 (released today): https://github.com/TheStreamCode/hermes-muse-code/releases/tag/v0.6.4

    What was wrong

    Your diagnosis was right about the seam, and the suggestion to override resolve_api_key_secret() is what shipped. The key was only ever published as MUSE_CODE_SUB_TOKEN in os.environ at plugin import, so a credential resolver running in a different process never saw it:

    • plugins.isolation: host: the profile is a plugin-host proxy, so the module is imported in the host and the caller's environment is never seeded.
    • A long-running process whose plugin discovery ran before hermes auth add (gateway, Desktop): the import does not happen again, so the export never runs.
    • A fresh in-process hermes chat imports the plugin right before resolving the credential, which is why the standalone reproduction worked and the CLI/desktop did not.

    I reproduced both failing setups locally against v0.23.1: api_key came back empty with the adapter base_url intact, exactly the "No usable credentials" path at runtime_provider.py:907. That also explains the empty pool row: hermes auth add records the credential source, but the row never received a token because the export it watched for did not exist in that process.

    The fix

    MuseCodeSubscriptionProfile.resolve_api_key_secret() returns the cached key. Hermes consults it before the generic env/credential-pool ladder, and it is the only credential hook that crosses the plugin-host boundary. Precedence is unchanged: an explicit MUSE_CODE_SUB_TOKEN that differs from the cache returns None, so core's ladder keeps reading .env before the environment.

    No need for MUSE_CODE_SUB_TOKEN in .env after this. If you added one, remove it so the cache stays authoritative; a stale line would still win and reintroduce the 402 case from the README.

    Thanks for the detailed report, the environment details and the suggestion were enough to pin it down.

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