hermes - 💡(How to fix) Fix [Bug]: Gateway environment variable not expanded for custom model providers path [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

Additional Logs / Traceback (optional)

Root Cause

Root Cause Analysis (optional)

Fix Action

Fixed

Code Example

WARNING hermes_cli.config: providers.?: 'base_url' value '${ARC_BASE_URL}' is not a valid URL (no scheme or host) — skipped

---

Could not detect context length for model 'glm-5.1' at ${ARC_BASE_URL} — defaulting to 256,000 tokens

---

Report       https://paste.rs/US59z
agent.log    https://dpaste.com/CZR6JH8E5
gateway.log  https://dpaste.com/4DB5MQ8HJ

---
RAW_BUFFERClick to expand / collapse

Bug Description

_load_gateway_config() in gateway/run.py returns raw YAML via read_raw_config() without expanding ${VAR} environment variable references. This causes custom_providers entries that use env var templates (e.g. base_url: ${ARC_BASE_URL}) to fail URL validation with spurious warnings and be silently skipped.

_load_gateway_config() calls read_raw_config() which returns the raw YAML dict without running _expand_env_vars(). The expanded config from load_config() and the module-level co nfig bridge at gateway startup both expand env vars correctly, but _load_gateway_config() bypasses that entirely.

This affects multiple call sites in gateway/run.py that pass the unexpanded config to:

  • get_compatible_custom_providers() (lines ~6527, ~7224)
  • Model resolution and context-length detection
  • Hygiene worker agent creation

Steps to Reproduce

  1. Add base_url: ${SOME_VAR} to a custom_providers entry in config.yaml
  2. Define SOME_VAR in ~/.hermes/.env
  3. Start the gateway
  4. Observe the warning in logs on every agent creation via the gateway path

Expected Behavior

Environment variable expansion to work for custom models.

Actual Behavior

WARNING hermes_cli.config: providers.?: 'base_url' value '${ARC_BASE_URL}' is not a valid URL (no scheme or host) — skipped

This also causes model.base_url to remain unexpanded in gateway agent-creation paths (hygiene worker, context-length probe), producing:

Could not detect context length for model 'glm-5.1' at ${ARC_BASE_URL} — defaulting to 256,000 tokens

Affected Component

Configuration (config.yaml, .env, hermes setup)

Messaging Platform (if gateway-related)

No response

Debug Report

Report       https://paste.rs/US59z
agent.log    https://dpaste.com/CZR6JH8E5
gateway.log  https://dpaste.com/4DB5MQ8HJ

Operating System

Ubuntu 25.10

Python Version

No response

Hermes Version

No response

Additional Logs / Traceback (optional)

Root Cause Analysis (optional)

No response

Proposed Fix (optional)

Apply _expand_env_vars() to both return paths in _load_gateway_config() — the read_raw_config() fast path and the yaml.safe_load fallback.

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING