ClawKit Logo
ClawKitReliability Toolkit

Fix Discord modelByChannel Schema Validation Error

[Config] Validation error in channels.discord.modelByChannel:
  Unrecognized key: "123456789012345678"
  Expected array, received object

This error was introduced in OpenClaw 2026.2.21-2. The modelByChannel config format changed from an object to an array. If you upgraded from 2026.2.20 or earlier, your config needs updating.

OpenClaw 2026.2.21-2 changed the schema for channels.discord.modelByChannel from a map (object keyed by channel ID) to an array of channel-model pairs. Configs using the old format fail validation at startup and the Discord channel won't start.

Next Step

Fix now, then reduce repeat incidents

If this issue keeps coming back, validate your setup in Doctor first, then harden your config.

Update modelByChannel Config

Here is the old format (broken in 2026.2.21+) and the new format:

Old Format (Broken)

"modelByChannel": {
  "123456789012345678": "openai/gpt-4o",
  "987654321098765432": "anthropic/claude-sonnet-4-6"
}

New Format (2026.2.21+)

"modelByChannel": [
  {
    "channelId": "123456789012345678",
    "model": "openai/gpt-4o"
  },
  {
    "channelId": "987654321098765432",
    "model": "anthropic/claude-sonnet-4-6"
  }
]

Full Discord Channel Config Example

Updated openclaw.json Discord channel config
{
  "channels": {
    "discord": {
      "token": "YOUR_BOT_TOKEN",
      "model": "openai/gpt-4o",
      "modelByChannel": [
        {
          "channelId": "123456789012345678",
          "model": "anthropic/claude-sonnet-4-6"
        },
        {
          "channelId": "987654321098765432",
          "model": "google/gemini-2.0-flash"
        }
      ],
      "intents": ["Guilds", "GuildMessages", "MessageContent", "DirectMessages"]
    }
  }
}

The top-level "model" field sets the default model for all channels not listed in modelByChannel. This is unchanged.

Validate Config and Restart

Validate config and restart gateway
# Validate config syntax
openclaw config check

# Restart gateway to apply changes
openclaw gateway restart

# Watch logs to confirm Discord channel starts
openclaw gateway logs --follow

After updating the config, the Discord channel should start without schema errors. You should see [Discord] Channel connected in the gateway logs.

Did this guide solve your problem?