Skip to content

bug: picker writes literal 'custom' to model.provider instead of actual provider name #17478

@Andy283

Description

@Andy283

Description

When using the hermes model interactive picker to switch to a model under custom_providers:, the CLI can write the literal string custom to model.provider in config.yaml instead of the actual provider name (e.g. xiaomi-coding).

This causes every subsequent session to fail with:

✗ Unknown provider 'custom'. Check 'hermes model' for available providers, or define it in config.yaml under 'providers:'.

Root Cause

In hermes_cli/model_switch.py list_authenticated_providers() (lines 1466-1472), slug assignment logic:

if current_base_url and api_url == current_base_url.strip().rstrip('/'):
    slug = current_provider or custom_provider_slug(display_name)
else:
    slug = custom_provider_slug(display_name)

When a prior failed switch already wrote provider: custom to config.yaml, current_provider = 'custom'. On the next picker run, if current_base_url matches, slug = current_provider = 'custom' (literal). The picker passes 'custom' as explicit_provider to switch_model().

Then resolve_provider_full('custom', ...) checks:

  • Built-in providers → no match
  • providers: dict → empty, no match
  • custom_providers → slug is custom:xiaomi-coding, doesn't match bare 'custom'
  • Returns None → error at model_switch.py:654

Config State That Triggers It

model:
  provider: custom          # ← should be 'xiaomi-coding' or 'custom:xiaomi-coding'
  base_url: ''
custom_providers:
  - name: xiaomi-coding
    base_url: https://token-plan-sgp.xiaomimimo.com/v1

Suggested Fix

In resolve_provider_full() or the slug assignment logic, either:

  1. Reject bare 'custom' as a valid slug — always require the full custom:<name> format
  2. When current_provider == 'custom', look up the matching custom_provider by base_url and use the proper slug
  3. In startup validation (main.py:1570+), detect provider: custom and auto-resolve to the correct custom_provider entry

Workaround

hermes config set model.provider <actual-provider-name>

Key Source Files

  • hermes_cli/model_switch.pyswitch_model(), list_authenticated_providers()
  • hermes_cli/providers.pyresolve_provider_full(), resolve_custom_provider(), custom_provider_slug()
  • hermes_cli/main.py — startup provider validation (line 1570+)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/cliCLI entry point, hermes_cli/, setup wizardtype/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