You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

归档聊天后App states regular_low/regular_high不同步及LTHash匹配失败

归档聊天功能后续操作失败问题排查

问题背景

我们正在为应用添加单条消息归档聊天功能:首次归档可正常运行,但后续发送消息的归档操作全部失败,报错如下。

核心代码片段

消息发送并归档的关键实现代码:

userJID := types.NewJID(phoneNumber, types.DefaultUserServer)
message := &waProto.Message{
    Conversation: proto.String(messageContent),
}
ctx := context.Background()
resp, err := client.SendMessage(ctx, userJID, message)
chatID := resp.ID
messageTimeStamp := resp.Timestamp
lastMessageKey := &waProto.MessageKey{
    RemoteJid: proto.String(userJID.String()),
    FromMe:    proto.Bool(true),
    Id:        proto.String(chatID),
}
archiveChat := true

archivePatch := appstate.BuildArchive(userJID, *proto.Bool(archiveChat), messageTimeStamp, lastMessageKey)
err = client.SendAppState(archivePatch)

首次报错日志

执行client.SendAppState(archivePatch)时返回的XML格式错误信息:

<?xml version="1.0"?>
<collection has_more_patches="true" name="regular_low" type="error">
  <error code="409" text="conflict"/>
  <patches>
    <patch><!-- 867 bytes --></patch>
    <patch><!-- 1175 bytes --></patch>
    <patch><!-- 1021 bytes --></patch>
    <patch><!-- 1313 bytes --></patch>
    <patch><!-- 1329 bytes --></patch>
    <patch><!-- 1021 bytes --></patch>
    <patch><!-- 1021 bytes --></patch>
    <patch><!-- 1021 bytes --></patch>
   ...
  </patches>
</collection>

尝试的修复操作及新错误

为同步补丁状态,我在归档前加入了以下代码:

for _, name := range appstate.AllPatchNames {
    err := client.FetchAppState(name, true, false)
    if err != nil {
        client.Log.Errorf("Failed to do initial fetch of app state %s: %v", name, err)
    }
}

但执行后出现两个补丁验证错误:

[Client ERROR] Failed to do initial fetch of app state regular_high: failed to decode app state regular_high patches: failed to verify patch v897: mismatching LTHash

[Client ERROR] Failed to do initial fetch of app state regular_low: failed to decode app state regular_low patches: failed to verify patch v712: mismatching LTHash

问题

请问这是什么原因?是否需要重新计算LTHash?如果是,该如何操作?

内容的提问来源于stack exchange,提问作者Miguel Gomez

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 19:28:31