JeffreySu/WeiXinMPSDK · error · MessageHandlerException

微信公众号不支持 IResponseMessageVideo 响应类型

Error message

微信公众号不支持 IResponseMessageVideo 响应类型

What it means

WxOpenMessageEntityEnlightener.NewResponseMessageVideo unconditionally throws MessageHandlerException. Video replies are a 公众号 (MP) response type unsupported by the WxOpen pipeline, so the factory throws MessageHandlerException instead of returning an entity.

Solutions

  1. Reply with a supported WxOpen type such as ResponseMessageText.
  2. Use ResponseMessageTransfer_Customer_Service so media replies can be sent by MP customer service.
  3. Gate video-reply code behind a platform check so it only runs in MP handlers.

Example fix

// before
var video = enlightener.NewResponseMessageVideo();
// after
var reply = enlightener.NewResponseMessageTransfer_Customer_Service();
Defensive patterns

Strategy: validation

Validate before calling

if (platform == Platform.WxOpen && replyKind == ReplyKind.Video)
    replyKind = ReplyKind.TransferCustomerService;

Type guard

static bool IsVideoResponse(IResponseMessageBase r) => r is IResponseMessageVideo; // invalid in WxOpen

Try / catch

try
{
    var video = enlightener.NewResponseMessageVideo();
}
catch (MessageHandlerException)
{
    reply = enlightener.NewResponseMessageTransfer_Customer_Service();
}

Prevention

When it happens

Trigger: Calling NewResponseMessageVideo() on the WxOpen enlightener, typically from a WxOpen On* handler attempting a video reply or shared MP reply-generation code.

Common situations: Porting MP video-reply handlers to Mini Programs; unified response factories that create video replies regardless of platform.

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


AI-assisted analysis of JeffreySu/WeiXinMPSDK@be573f6f94 (2026-09-12). Data as JSON: /api/errors/be7f80f51ff0b3a7. Report an issue: GitHub.

Appendix: source

Thrown at src/Senparc.Weixin.WxOpen/src/Senparc.Weixin.WxOpen/Senparc.Weixin.WxOpen/MessageHandlers/WxOpenMessageEntityEnlightener.cs:95

        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 响应类型");
        }

        public override IResponseMessageVoice NewResponseMessageVoice()
        {
            throw new MessageHandlerException("微信公众号不支持 IResponseMessageVoice 响应类型");
        }

        public override IRequestMessageMiniProgramPage NewRequestMessageMiniProgramPage()
        {
            return new RequestMessageMiniProgramPage();
        }

    }
}

View on GitHub (pinned to be573f6f94)