> ## Documentation Index
> Fetch the complete documentation index at: https://nvd-54.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MESSAGE_COERCION_FAILURE

当消息对象不符合预期格式时会发生此错误。

TODO: 添加 JS 示例

## 故障排除

要解决此错误：

1. **确保正确的格式**：所有传递给聊天模型的输入必须是 LangChain 消息类的数组或受支持的类消息格式
2. 验证您的消息没有发生意外的字符串化或转换
3. 检查错误的堆栈跟踪，并在消息传递给模型之前添加日志语句来检查消息对象

***

<div className="source-links">
  <Callout icon="terminal-2">
    [将这些文档连接到](/use-these-docs) Claude、VSCode 等工具，通过 MCP 获取实时答案。
  </Callout>

  <Callout icon="edit">
    [在 GitHub 上编辑此页面](https://github.com/langchain-ai/docs/edit/main/src/oss/langchain/errors/MESSAGE_COERCION_FAILURE.mdx) 或 [提交问题](https://github.com/langchain-ai/docs/issues/new/choose)。
  </Callout>
</div>
