Skip to content

Bug: WhatsApp channel fails to load - "Unrecognized key: enabled" in Zod strict schema #24931

Description

@lancer-code

Bug Description

The WhatsApp channel plugin fails to load with the error Unsupported channel: whatsapp because the Zod validation schema rejects the enabled key that the gateway automatically injects into channel configs.

Steps to Reproduce

  1. Fresh install of OpenClaw (v2026.2.23, built from source)
  2. Enable WhatsApp channel: openclaw channels enable whatsapp
  3. Restart the gateway
  4. Attempt to use WhatsApp channel → Dashboard shows "Config unavailable"
  5. Gateway logs show: Config validation failed: channels.whatsapp: Unrecognized key: "enabled"

Root Cause

In src/config/zod-schema.providers-whatsapp.ts:

  • WhatsAppAccountSchema correctly includes enabled: z.boolean().optional()
  • WhatsAppConfigSchema does NOT include the enabled field
  • WhatsAppConfigSchema uses .strict() which rejects any unrecognized keys

When the gateway auto-enables a plugin, it writes "enabled": true at the top-level channel config object. Since WhatsAppConfigSchema doesn't declare enabled but uses .strict(), validation fails silently (logged as WARNING), and the plugin never registers — resulting in "Unsupported channel: whatsapp".

Fix

Add enabled: z.boolean().optional() to WhatsAppConfigSchema:

export const WhatsAppConfigSchema = WhatsAppSharedSchema.extend({
  enabled: z.boolean().optional(),  // ← Add this line
  accounts: z.record(z.string(), WhatsAppAccountSchema.optional()).optional(),
  mediaMaxMb: z.number().int().positive().optional().default(50),
  // ... rest of schema
})
  .strict()
  .superRefine(/* ... */);

Impact

  • Severity: High — WhatsApp channel is completely broken on fresh installs
  • Affected versions: v2026.2.23 (likely earlier versions too)
  • Workaround: Manually patch the source file and rebuild

Notes

  • This bug may also affect other channel plugins that use .strict() Zod schemas without declaring the enabled field
  • The error appears as a WARNING in logs but has a cascading effect of preventing the entire plugin from loading
  • The WhatsAppAccountSchema already has enabled — this was just missed at the WhatsAppConfigSchema level

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions