Skip to content

[Bug] Custom/Google provider not resolved in fallback_model and fallback_providers #5392

@ldk00315-jpg

Description

@ldk00315-jpg

Problem

When using Google Gemini as the primary model via provider: custom + base_url, everything works correctly (confirmed with v0.7.0). However, when trying to use the same Google Gemini endpoint as a fallback provider, resolve_provider_client in auxiliary_client.py fails with:
WARNING agent.auxiliary_client: resolve_provider_client: custom/main requested but no endpoint credentials found
WARNING root: Fallback to custom failed: provider not configured

This happens regardless of whether:

  • fallback_model uses provider: custom with base_url + api_key_env
  • fallback_model uses provider: custom with base_url + api_key: ${GOOGLE_API_KEY}
  • fallback_model uses provider: google
  • fallback_providers array entries include base_url/api_key fields
  • custom_providers is used to register a named provider
  • OPENAI_BASE_URL + OPENAI_API_KEY are set in .env

The root cause appears to be that resolve_provider_client does not resolve custom as a provider (returns None), and google is not in the supported fallback provider list. This is the same underlying issue as #4172, but that fix only addressed the primary model path — the fallback code path in auxiliary_client.py still has the same problem.

Expected Behavior

Google Gemini should work as a fallback provider, either:

  1. By adding google as a first-class fallback provider (using GOOGLE_API_KEY from .env), or
  2. By making provider: custom actually read base_url/api_key/api_key_env from fallback_model and fallback_providers config entries

Environment

  • Hermes Agent v0.7.0 (v2026.4.3)
  • Primary: openai-codex/gpt-5.3-codex
  • Desired fallback: gemini-3-flash-preview via https://generativelanguage.googleapis.com/v1beta/openai
  • GOOGLE_API_KEY set in ~/.hermes/.env
  • Google Gemini works perfectly as primary model with provider: custom

Workaround

Using Gemini as the primary model instead and falling back to Codex/OpenRouter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existsarea/configConfig system, migrations, profilesprovider/geminiGoogle Gemini (AI Studio, Cloud Code)type/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions