JeffreySu/WeiXinMPSDK · error · MessageHandlerException
微信公众号不支持 IResponseMessageNews 响应类型
Error message
微信公众号不支持 IResponseMessageNews 响应类型
What it means
WxOpenMessageEntityEnlightener.NewResponseMessageNews unconditionally throws MessageHandlerException. News (图文) replies are 公众号-specific; the WxOpen factory intentionally rejects building them because Mini Program messages cannot respond with news articles.
Solutions
- Return ResponseMessageText or ResponseMessageTransfer_Customer_Service in WxOpen handlers.
- Remove the news-reply branch from WxOpen message handling.
- Deliver article links as plain text within a text response if the content is needed.
Example fix
// before
var news = enlightener.NewResponseMessageNews();
// after
var reply = enlightener.NewResponseMessageText();
reply.Content = $"<a href=\"{articleUrl}\">{articleTitle}</a>"; Defensive patterns
Strategy: validation
Validate before calling
if (replyKind == ReplyKind.News && platform == Platform.WxOpen)
replyKind = ReplyKind.TextWithLink; // send article URL as text instead Type guard
static bool IsNewsResponse(IResponseMessageBase r) => r is IResponseMessageNews; // invalid in WxOpen
Try / catch
try
{
var news = enlightener.NewResponseMessageNews();
}
catch (MessageHandlerException)
{
var reply = enlightener.NewResponseMessageText();
reply.Content = articleUrl; // degrade gracefully
} Prevention
- Deliver 图文 content in WxOpen as text containing links, not News entities.
- Branch reply generation on platform before building responses.
- Review the enlightener to confirm which New* methods return entities vs throw.
When it happens
Trigger: Calling NewResponseMessageNews() on the WxOpen enlightener, e.g. a WxOpen handler trying to return a news response or generic reply code that builds news messages for all platforms.
Common situations: Reusing MP 图文 reply handlers in WxOpen; shared response-builder utilities without platform guards.
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
- 微信公众号不支持 IResponseMessageImage 响应类型
- 微信公众号不支持 IResponseMessageMpNews 响应类型
- 微信公众号不支持 IResponseMessageMusic 响应类型
- 微信公众号不支持 IResponseMessageVideo 响应类型
- 微信公众号不支持 IResponseMessageVoice 响应类型
AI-assisted analysis of JeffreySu/WeiXinMPSDK@be573f6f94 (2026-09-12).
Data as JSON: /api/errors/e161845376ef3685.
Report an issue: GitHub.
Appendix: source
Thrown at src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/MessageHandlers/WxOpenMessageEntityEnlightener.cs:79
public override IResponseMessageImage NewResponseMessageImage()
{
throw new MessageHandlerException("微信公众号不支持 IResponseMessageImage 响应类型");
}
public override IResponseMessageMpNews NewResponseMessageMpNews()
{
throw new MessageHandlerException("微信公众号不支持 IResponseMessageMpNews 响应类型");
}
public override IResponseMessageMusic NewResponseMessageMusic()
{
throw new MessageHandlerException("微信公众号不支持 IResponseMessageMusic 响应类型");
}
public override IResponseMessageNews NewResponseMessageNews()
{
throw new MessageHandlerException("微信公众号不支持 IResponseMessageNews 响应类型");
}
public override IResponseMessageText NewResponseMessageText()
{
return new Senparc.Weixin.MP.Entities.ResponseMessageText();
//throw new MessageHandlerException("微信公众号不支持 IResponseMessageText 响应类型");
}
public override IResponseMessageTransfer_Customer_Service NewResponseMessageTransfer_Customer_Service()
{
return new ResponseMessageTransfer_Customer_Service();
}
public override IResponseMessageVideo NewResponseMessageVideo()
{
throw new MessageHandlerException("微信公众号不支持 IResponseMessageVideo 响应类型");
}
View on GitHub (pinned to be573f6f94)