Skip to content

Fix: QQReplyMessage message_type / msg_idx 应可空 - #228

Open
Yushu2606 wants to merge 1 commit into
nonebot:masterfrom
Yushu2606:patch-3
Open

Fix: QQReplyMessage message_type / msg_idx 应可空#228
Yushu2606 wants to merge 1 commit into
nonebot:masterfrom
Yushu2606:patch-3

Conversation

@Yushu2606

@Yushu2606 Yushu2606 commented Aug 13, 2026

Copy link
Copy Markdown

Closes #217

回复一条本身带有多层嵌套引用链的消息时,生成的 msg_elements 条目仅为合成的摘要大文本块(只有内容,缺少 message_typemsg_idx 字段)。
Pydantic 校验抛出两个字段的“字段必填”错误,事件解析静默失败。该错误被 dispatch_event 内部的 try‑except 捕获,因此不会造成进程崩溃,但该消息永远不会投递到任何业务处理器。
已对照生产报错堆栈里的原始异常载荷完成验证:此前会抛出 ValidationError;现在当 message_type=Nonemsg_idx=None 时可以正常解析。已确认普通正常场景(两个字段均存在)不受改动影响。

Real production traffic: replying to a message that itself contains a
nested quote chain produces a msg_elements entry that's just a
synthesized summary blob (content only, no message_type/msg_idx) --
pydantic validation failed with "Field required" for both, and the
event silently failed to parse (caught by dispatch_event's own
try/except, so it doesn't crash the process, but the message is never
delivered to any handler).

Verified against the exact failing payload from a production
traceback: previously raised ValidationError, now parses correctly
with message_type=None/msg_idx=None. Confirmed the normal case (both
fields present) is unaffected.
@yanyongyu yanyongyu added the bug Something isn't working label Aug 17, 2026
@yanyongyu yanyongyu changed the title fix: QQReplyMessage.message_type/msg_idx 应可空 Fix: QQReplyMessage message_type/msg_idx 应可空 Aug 17, 2026
@yanyongyu yanyongyu changed the title Fix: QQReplyMessage message_type/msg_idx 应可空 Fix: QQReplyMessage message_type / msg_idx 应可空 Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Development

Successfully merging this pull request may close these issues.

群全量(全部群消息)状态下,用户 引用 [转发消息] 会报错

2 participants