JeffreySu/WeiXinMPSDK · error · UnknownRequestMsgTypeException
未知的企业客户标签变更事件Event.CHANGE_EXTERNAL_Tag下属请求信息
Error message
未知的企业客户标签变更事件Event.CHANGE_EXTERNAL_Tag下属请求信息
What it means
This guard fires in OnEventRequestAsync for Event.CHANGE_EXTERNAL_TAG (enterprise customer tag change) callbacks when the ExternalTagChangeType has no matching case. Note the message text is misleadingly phrased ('CHANGE_EXTERNAL_Tag', and duplicated with the external-chat message), but it is the tag-change dispatch's default case.
Solutions
- Upgrade Senparc.Weixin.Work to support the latest ExternalTagChangeType members
- Override the tag-event dispatch in a derived WorkMessageHandler and handle the missing sub-type
- Catch UnknownRequestMsgTypeException at the callback boundary, log the ChangeType, and return 'success' to acknowledge the callback
Example fix
// before
var response = await handler.OnEventRequestAsync(tagEvent);
// after
try { var response = await handler.OnEventRequestAsync(tagEvent); }
catch (UnknownRequestMsgTypeException ex) { _logger.LogWarning(ex, "Unhandled change_external_tag ChangeType"); return "success"; } Defensive patterns
Strategy: try-catch
Validate before calling
if (!Enum.IsDefined(typeof(ExternalTagChangeType), tagEvent.ChangeType)) { return null; } Type guard
bool IsKnownExternalTagChange(RequestMessageEvent_Change_External_Tag_Base e) => Enum.IsDefined(typeof(ExternalTagChangeType), e.ChangeType);
Try / catch
try { response = await handler.OnEventRequestAsync(evt); } catch (UnknownRequestMsgTypeException ex) { _logger.LogWarning(ex, "Unhandled change_external_tag ChangeType"); return "success"; } Prevention
- Keep the SDK current for tag-management sub-events
- Scope suite callback URLs to handled event categories
- Log unknown ChangeType values for postmortem
- Acknowledge unknown events with 'success'
When it happens
Trigger: A 'change_external_tag' WeCom callback arrives whose ExternalTagChangeType (add, update, dismiss, shuffle, etc.) is unrecognized — a sub-type added by Tencent after your library version or an unexpected payload value.
Common situations: Library versions predating a new tag-change sub-event; WeCom sending tag events to apps whose callback config receives all contact events; hand-written test ChangeType strings.
Related errors
- 未知的Event.change_contact下属请求信息
- 未知的外部联系人事件Event.CHANGE_EXTERNAL_CONTACT下属请求信息
- 未知的客户群变更事件Event.CHANGE_EXTERNAL_CHAT下属请求信息
- 未知的Event下属请求信息
- 未知的InfoType请求类型
AI-assisted analysis of JeffreySu/WeiXinMPSDK@be573f6f94 (2026-09-12).
Data as JSON: /api/errors/98328afd83187580.
Report an issue: GitHub.
Appendix: source
Thrown at src/Senparc.Weixin.Work/Senparc.Weixin.Work/MessageHandlers/Async/WorkMessageHandler.Async.cs:373
switch (cechat.ChangeType)
{
case ExternalChatChangeType.create:
responseMessage = await
OnEvent_ChangeExternalChatCreateRequestAsync(
RequestMessage as RequestMessageEvent_Change_External_Chat_Create);
break;
case ExternalChatChangeType.update:
responseMessage = await
OnEvent_ChangeExternalChatUpdateRequestAsync(
RequestMessage as RequestMessageEvent_Change_External_Chat_Update);
break;
case ExternalChatChangeType.dismiss:
responseMessage = await
OnEvent_ChangeExternalChatDismissRequestAsync(
RequestMessage as RequestMessageEvent_Change_External_Chat_Dismiss);
break;
default:
throw new UnknownRequestMsgTypeException("未知的企业客户标签变更事件Event.CHANGE_EXTERNAL_Tag下属请求信息",
null);
}
break;
case Event.CHANGE_EXTERNAL_TAG: //企业客户标签变更事件
var tag = RequestMessage as RequestMessageEvent_Change_External_Tag_Base;
switch (tag.ChangeType)
{
case ExternalTagChangeType.create:
responseMessage = await
OnEvent_ChangeExternalTagCreateRequestAsync(
RequestMessage as RequestMessageEvent_Change_External_Tag_Create);
break;
case ExternalTagChangeType.update:
responseMessage = await
OnEvent_ChangeExternalTagUpdateRequestAsync(
RequestMessage as RequestMessageEvent_Change_External_Tag_Update);View on GitHub (pinned to be573f6f94)