{"record":{"id":"a090087e8cfb6bf2","repo":"chenhg5/cc-connect","slug":"s-sendvideo-invalid-reply-context-type-t","errorCode":null,"errorMessage":"%s: SendVideo: invalid reply context type %T","messagePattern":"(.+?): SendVideo: invalid reply context type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":5544,"sourceCode":"\t\t\t\"file_key\", fileKey, \"chat_id\", rc.chatID, \"format\", format)\n\t}\n\n\treturn p.sendMediaMessage(ctx, rc, larkim.MsgTypeAudio, audioContent)\n}\n\n// SendVideo uploads video bytes to Feishu and sends a native video\n// (MsgTypeMedia) message. Implements core.VideoSender.\n//\n// Feishu's File API only recognises \"mp4\" as the video file_type, so\n// every input is uploaded under that label. Actual playback depends on\n// the Feishu client (mp4 H.264 has the broadest support); other\n// containers like webm / mkv typically still upload but may render as\n// a download tile on some clients. The fallback path to SendFile in\n// engine.go preserves at least delivery when this happens.\nfunc (p *Platform) SendVideo(ctx context.Context, rctx any, video []byte, format string, fileName string) error {\n\trc, ok := rctx.(replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"%s: SendVideo: invalid reply context type %T\", p.tag(), rctx)\n\t}\n\tif fileName == \"\" {\n\t\tif format != \"\" {\n\t\t\tfileName = \"video.\" + format\n\t\t} else {\n\t\t\tfileName = \"video.mp4\"\n\t\t}\n\t}\n\n\tvar uploadResp *larkim.CreateFileResp\n\tif err := p.withTransientRetry(ctx, \"upload video\", func() error {\n\t\treturn p.withFreshTenantAccessTokenRetry(ctx, \"upload video\", func(client *lark.Client, options ...larkcore.RequestOptionFunc) error {\n\t\t\treq := larkim.NewCreateFileReqBuilder().\n\t\t\t\tBody(larkim.NewCreateFileReqBodyBuilder().\n\t\t\t\t\tFileType(larkim.FileTypeMp4).\n\t\t\t\t\tFileName(fileName).\n\t\t\t\t\tFile(bytes.NewReader(video)).\n\t\t\t\t\tBuild()).","sourceCodeStart":5526,"sourceCodeEnd":5562,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L5526-L5562","documentation":"SendVideo implements the core.VideoSender interface and requires the rctx parameter to be the platform-internal replyContext type. This error is thrown when the type assertion rctx.(replyContext) fails, mirroring error 1233 but for video: the caller passed a reply context that did not originate from this Feishu platform instance.","triggerScenarios":"Calling SendVideo with an rctx from another platform adapter, a plain string ID, nil, or a value built by a different build of the feishu package.","commonSituations":"Generic media-forwarding code storing reply contexts across platforms; dual feishu package versions linked into one binary; custom agent bridging passing the wrong context type.","solutions":["Pass the replyContext value returned by this platform's message/reply APIs as-is","Ensure a single version of the feishu package is in the build (go version -m)","Route video through the engine's reply pipeline rather than constructing contexts manually","Keep per-platform maps if you cache reply contexts generically"],"exampleFix":"// before\nfeishuPlatform.SendVideo(ctx, telegramReplyCtx, video, \"mp4\", \"clip.mp4\")\n// after\nif rc, ok := ctx.Value(feishu.ReplyContextKey).(feishu.ReplyContext); ok {\n    feishuPlatform.SendVideo(ctx, rc, video, \"mp4\", \"clip.mp4\")\n}","handlingStrategy":"type-guard","validationCode":"if _, ok := rctx.(feishu.ReplyContext); !ok { return fmt.Errorf(\"SendVideo requires a feishu reply context, got %T\", rctx) }","typeGuard":"func asFeishuReplyContext(v any) (feishu.ReplyContext, bool) { rc, ok := v.(feishu.ReplyContext); return rc, ok }","tryCatchPattern":null,"preventionTips":["Pass reply contexts unmodified from the platform's own handlers","Ensure one feishu package version per binary","Keep reply-context caches keyed by platform","Route media through the engine, not cross-platform direct calls"],"tags":["feishu","type-assertion","video","reply-context"],"backgroundTag":"type-mismatch","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}