Skip to content

[Bug]: Model switching via /model command rejected despite valid allowlist config #20291

@kensipe

Description

@kensipe

Summary

Switching models via the TUI /model command (dropdown or typed) fails with model not allowed even when agents.defaults.models allowlist is correctly configured. The TUI dropdown also sends stale model IDs (e.g. claude-sonnet-4-5 instead of claude-sonnet-4-6).

Steps to reproduce

Steps to reproduce:

  1. Configure agents.defaults.models with anthropic/claude-sonnet-4-6 and an alias
  2. Run openclaw models status — confirms model is in allowlist
  3. Open TUI, type /model, select Sonnet from dropdown
  4. Gateway returns: model not allowed: anthropic/claude-sonnet-4-5
  5. Manually typing /model anthropic/claude-sonnet-4-6 also returns model not allowed

Expected behavior

Model switches successfully

Actual behavior

INVALID_REQUEST errorMessage=model not allowed

OpenClaw version

2026.2.17

Operating system

macOS 25.3.0 (arm64)

Install method

npm global

Logs, screenshots, and evidence

So even the exact string anthropic/claude-sonnet-4-6 typed manually is rejected. The allowlist is in the config but the gateway isn't honoring it. This is definitely a bug in 2026.2.17.

 Let me try one more thing — maybe the config key needs to be at a different path:

 Config is correct. The openclaw models status CLI reads it fine. But the running gateway rejects it. I think the session-level model override check uses a different code path that doesn't read from agents.defaults.models.

 This is a bug worth reporting. For now, practical workaround — I can switch the primary model for you via config patch when you want to use Sonnet:

 - Tell me "switch to sonnet" → I patch the primary model + restart
 - Tell me "switch to opus" → I patch it back

Impact and severity

No response

Additional information

Additional context:

  • openclaw models status correctly shows all 3 models in allowlist
  • The allowlist appears to be ignored at runtime for session-level overrides
  • In 2026.2.15 the gateway also crashed on failed switch (fixed in 2026.2.17)
  • Workaround: patching agents.defaults.model.primary via config works

Relevant log:

  [ws] ⇄ res ✗ sessions.patch errorCode=INVALID_REQUEST errorMessage=model not allowed: anthropic/claude-sonnet-4-6
  [ws] ⇄ res ✗ sessions.patch errorCode=INVALID_REQUEST errorMessage=model not allowed: anthropic/claude-sonnet-4-5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions