Skip to content

channels.modelByChannel rejected by config validation despite being in Zod schema #23038

@hello-im-cat

Description

@hello-im-cat

Bug

channels.modelByChannel is documented in the configuration reference and defined in the Zod schema (ChannelModelByChannelSchema in ChannelsSchema), but gets rejected at startup and via openclaw config set with:

channels.modelByChannel: unknown channel id: modelByChannel

Steps to Reproduce

  1. Add to openclaw.json:
{
  "channels": {
    "modelByChannel": {
      "discord": {
        "123456789012345678": "anthropic/claude-sonnet-4-6"
      }
    }
  }
}
  1. Run openclaw gateway restart or openclaw config set channels.modelByChannel ...
  2. Gateway fails to start / config set returns validation error

Analysis

The Zod schema in the compiled source (config-DJkRS0fq.js) correctly defines:

const ChannelsSchema = z.object({
  defaults: ...,
  modelByChannel: ChannelModelByChannelSchema,  // ✅ defined
  whatsapp: ...,
  discord: ...,
  // ...
}).passthrough().optional();

And the runtime code in subagent-registry-Bdm_X-N1.js reads it:

const modelByChannel = params.cfg.channels?.modelByChannel;

The prompt-select-styled module also explicitly skips it:

if (channelId === "defaults" || channelId === "modelByChannel") continue;

But there appears to be a separate validation pass (likely in the config set CLI or startup channel iteration) that treats every key under channels as a channel ID and rejects modelByChannel as unknown.

Environment

  • OpenClaw: 2026.2.21-2
  • OS: macOS 15.7.4 (arm64)
  • Node: v25.5.0

Expected Behavior

channels.modelByChannel should be accepted by both the CLI config commands and gateway startup, matching the docs and Zod schema.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions