JeffreySu/WeiXinMPSDK · error · MessageHandlerException
微信企业号不支持 IResponseMessageMpNews 响应类型
Error message
微信企业号不支持 IResponseMessageMpNews 响应类型
What it means
The WeChat Work (企业号/企业微信) message handler does not support the MpNews response type. WorkMessageEntityEnlightener.NewResponseMessageMpNews() unconditionally throws MessageHandlerException because WeChat Work's message API has no equivalent of the Official Account's mpnews message.
Solutions
- Replace IResponseMessageMpNews with a supported Work response type such as ResponseMessageNews, ResponseMessageText, or ResponseMessageImage.
- Guard for platform differences: only create MpNews responses in the MP message handler, not the Work one.
- If news-style content is needed, send it via a Work API call (e.g. news-type message via Senparc.Weixin.Work message APIs) instead of the passive reply.
Example fix
// before
public override IWorkResponseMessageBase DefaultResponseMessage(IWorkRequestMessageBase rm)
{
var resp = requestMessageHandler.CreateResponseMessage<IResponseMessageMpNews>();
...
}
// after
public override IWorkResponseMessageBase DefaultResponseMessage(IWorkRequestMessageBase rm)
{
var resp = requestMessageHandler.CreateResponseMessage<IResponseMessageNews>();
...
} Defensive patterns
Strategy: validation
Validate before calling
if (handler is Senparc.Weixin.Work.MessageHandlers.WorkMessageHandler<>)
{
// WeChat Work never supports MpNews replies — pick a supported type
response = handler.CreateResponseMessage<IResponseMessageNews>();
} Type guard
bool IsWorkHandler(MessageHandler<DefaultWorkMessageContext> h) => h is Senparc.Weixin.Work.MessageHandlers.WorkMessageHandler<DefaultWorkMessageContext>;
Try / catch
try
{
resp = handler.CreateResponseMessage<IResponseMessageMpNews>();
}
catch (MessageHandlerException)
{
resp = handler.CreateResponseMessage<IResponseMessageNews>();
} Prevention
- Consult the Work SDK's supported response types before replying; MpNews/Music/Transfer_Customer_Service are MP-only.
- Keep MP and Work handler code in separate classes rather than sharing a generic reply builder.
When it happens
Trigger: Calling NewResponseMessageMpNews() on a WorkMessageHandler's entity enlightener, e.g. inside an overridden DefaultResponseMessage or an OnXxxRequest handler when building an IResponseMessageMpNews reply.
Common situations: Developers porting code written for the WeChat Official Account (Senparc.Weixin.MP) to WeChat Work and reusing the same response-type factory pattern; MpNews exists only on MP.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- 微信企业号不支持 IResponseMessageMusic 响应类型
- 微信企业号不支持 IResponseMessageTransfer_Customer_Service 响应类型
- 微信企业号不支持 IRequestMessageMiniProgramPage 响应类型
- 微信公众号不支持 IResponseMessageImage 响应类型
- 微信公众号不支持 IResponseMessageMpNews 响应类型
AI-assisted analysis of JeffreySu/WeiXinMPSDK@be573f6f94 (2026-09-12).
Data as JSON: /api/errors/14f66ff7d4a6e8ef.
Report an issue: GitHub.
Appendix: source
Thrown at src/Senparc.Weixin.Work/Senparc.Weixin.Work/MessageHandlers/WorkMessageEntityEnlightener.cs:71
public override IRequestMessageVideo NewRequestMessageVideo()
{
return new RequestMessageVideo();
}
public override IRequestMessageVoice NewRequestMessageVoice()
{
return new RequestMessageVoice();
}
public override IResponseMessageImage NewResponseMessageImage()
{
return new ResponseMessageImage();
}
public override IResponseMessageMpNews NewResponseMessageMpNews()
{
throw new MessageHandlerException("微信企业号不支持 IResponseMessageMpNews 响应类型");
}
public override IResponseMessageMusic NewResponseMessageMusic()
{
throw new MessageHandlerException("微信企业号不支持 IResponseMessageMusic 响应类型");
}
public override IResponseMessageNews NewResponseMessageNews()
{
return new ResponseMessageNews();
}
public override IResponseMessageText NewResponseMessageText()
{
return new ResponseMessageText();
}
public override IResponseMessageTransfer_Customer_Service NewResponseMessageTransfer_Customer_Service()View on GitHub (pinned to be573f6f94)