![When [object Object] Is All Your Agent Hears](/_next/image?url=https%3A%2F%2Fmedia2.dev.to%2Fdynamic%2Fimage%2Fwidth%3D1200%2Cheight%3D627%2Cfit%3Dcover%2Cgravity%3Dauto%2Cformat%3Dauto%2Fhttps%253A%252F%252Fdev-to-uploads.s3.amazonaws.com%252Fuploads%252Farticles%252Fmf1ly913f9oqg42gyjbb.png&w=1200&q=75)
When [object Object] Is All Your Agent Hears
Your user sends a perfectly normal WhatsApp message. Your agent receives [object Object] . No error. No warning. Just... five words of garbage where their question used to be. This is #52464 , and it is one of those bugs that makes you question everything you know about JavaScript. The Setup OpenClaw's WhatsApp integration uses Baileys, which hands you raw message objects. Somewhere between Baileys and the LLM, there's a sanitization function: function sanitizeChatSendMessageInput ( message ) { const normalized = message . normalize ( " NFC " ); // ... } Looks fine, right? message is a string, .normalize() returns a normalized string. Ship it. Except sometimes message isn't a string. The Coercion When Baileys passes the raw message structure, JavaScript does not throw. It does something worse: it cooperates . const message = { conversation : " Hello, help me " }; message . normalize ( " NFC " ); // → "[object Object]" JavaScript calls .toString() first. Object.prototype.toString() retu
Continue reading on Dev.to JavaScript
Opens in a new tab




