Bug Description
When the alibaba provider is set in config.yaml but no API key is found, the error message instructs the user to set ALIBABA_API_KEY. However, the actual environment variable that Hermes reads is DASHSCOPE_API_KEY.
This causes confusion because setting ALIBABA_API_KEY has no effect -- the agent continues to fail with the same error.
Steps to Reproduce
- Set
provider: alibaba in ~/.hermes/config.yaml
- Set only
ALIBABA_API_KEY (not DASHSCOPE_API_KEY) in ~/.hermes/.env
- Start Hermes CLI or gateway
- Error:
RuntimeError: Provider 'alibaba' is set in config.yaml but no API key was found. Set the ALIBABA_API_KEY environment variable, or switch to a different provider with hermes model.
Expected Behavior
Either:
- The error message should say
DASHSCOPE_API_KEY (the actual env var name), OR
- Better: Accept both
DASHSCOPE_API_KEY and ALIBABA_API_KEY for the alibaba provider, for backward compatibility and usability
Actual Behavior
even if ALIBABA_API_KEY is set, Hermes reacts like:
Sorry, I encountered an error (RuntimeError).
Provider 'alibaba' is set in config.yaml but no API key was found. Set the ALIBABA_API_KEY environment variable, or switch to a different provider with hermes model.
Try again or use /reset to start a fresh session.
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp), Setup / Installation
Messaging Platform (if gateway-related)
No response
Debug Report
Report https://paste.rs/0rGof
agent.log https://paste.rs/YgcC5
gateway.log https://paste.rs/tfp2P
Operating System
macOS 26.4
Python Version
3.11.15
Hermes Version
0.8.0
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
In run_agent.py line 933-935:
raise RuntimeError(
f"Provider '{_explicit}' is set in config.yaml but no API key "
f"was found. Set the {_explicit.upper()}_API_KEY environment "
f"variable, or switch to a different provider with `hermes model`."
)
This dynamically constructs ALIBABA_API_KEY from provider="alibaba", but the actual credential resolution in hermes_cli/auth.py and hermes_cli/config.py expects DASHSCOPE_API_KEY.
Proposed Fix (optional)
Option A: Fix error message only
Add a provider-to-env-var mapping for accurate error messages:
_PROVIDER_ENV_VAR_MAP = {
"alibaba": "DASHSCOPE_API_KEY",
}
env_var_name = _PROVIDER_ENV_VAR_MAP.get(_explicit, f"{_explicit.upper()}_API_KEY")
Option B: Accept both env vars (recommended for UX)
In the credential resolution code, fall back to ALIBABA_API_KEY if DASHSCOPE_API_KEY is not set:
alibaba_key = os.getenv("DASHSCOPE_API_KEY") or os.getenv("ALIBABA_API_KEY")
And fix the error message to mention both:
"Set the DASHSCOPE_API_KEY (or ALIBABA_API_KEY) environment variable..."
### Are you willing to submit a PR for this?
- [x] I'd like to fix this myself and submit a PR
Bug Description
When the
alibabaprovider is set inconfig.yamlbut no API key is found, the error message instructs the user to setALIBABA_API_KEY. However, the actual environment variable that Hermes reads isDASHSCOPE_API_KEY.This causes confusion because setting
ALIBABA_API_KEYhas no effect -- the agent continues to fail with the same error.Steps to Reproduce
provider: alibabain~/.hermes/config.yamlALIBABA_API_KEY(notDASHSCOPE_API_KEY) in~/.hermes/.envRuntimeError: Provider 'alibaba' is set in config.yaml but no API key was found. Set the ALIBABA_API_KEY environment variable, or switch to a different provider with hermes model.Expected Behavior
Either:
DASHSCOPE_API_KEY(the actual env var name), ORDASHSCOPE_API_KEYandALIBABA_API_KEYfor the alibaba provider, for backward compatibility and usabilityActual Behavior
even if ALIBABA_API_KEY is set, Hermes reacts like:
Affected Component
Gateway (Telegram/Discord/Slack/WhatsApp), Setup / Installation
Messaging Platform (if gateway-related)
No response
Debug Report
Operating System
macOS 26.4
Python Version
3.11.15
Hermes Version
0.8.0
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
In
run_agent.pyline 933-935:This dynamically constructs
ALIBABA_API_KEYfromprovider="alibaba", but the actual credential resolution inhermes_cli/auth.pyandhermes_cli/config.pyexpectsDASHSCOPE_API_KEY.Proposed Fix (optional)
Option A: Fix error message only
Add a provider-to-env-var mapping for accurate error messages:
Option B: Accept both env vars (recommended for UX)
In the credential resolution code, fall back to
ALIBABA_API_KEYifDASHSCOPE_API_KEYis not set:And fix the error message to mention both: