{"record":{"id":"5614f1ea820edaed","repo":"chenhg5/cc-connect","slug":"platform-s-w","errorCode":null,"errorMessage":"platform %s: %w","messagePattern":"platform (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":11203,"sourceCode":"\n\tstate, p, replyCtx, err := e.resolveOutboundSessionTarget(sessionKey, len(images) > 0 || len(files) > 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif message == \"\" && len(images) == 0 && len(files) == 0 {\n\t\treturn fmt.Errorf(\"message or attachment is required\")\n\t}\n\tif (len(images) > 0 || len(files) > 0) && !e.attachmentSendEnabled {\n\t\treturn ErrAttachmentSendDisabled\n\t}\n\n\tvar imageSender ImageSender\n\tif len(images) > 0 {\n\t\tvar ok bool\n\t\timageSender, ok = p.(ImageSender)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"platform %s: %w\", p.Name(), ErrNotSupported)\n\t\t}\n\t}\n\n\tvar fileSender FileSender\n\tif len(files) > 0 {\n\t\tvar ok bool\n\t\tfileSender, ok = p.(FileSender)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"platform %s: %w\", p.Name(), ErrNotSupported)\n\t\t}\n\t}\n\n\tif message != \"\" {\n\t\tif err := e.waitOutgoing(p); err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// Use AtMentionSender when @users specified and platform supports it\n\t\tif len(opts.AtUsers) > 0 || opts.AtAll {","sourceCodeStart":11185,"sourceCodeEnd":11221,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L11185-L11221","documentation":"The engine wraps ErrNotSupported with the platform name when the target platform does not implement the optional ImageSender interface but the send request contains images. Rich media sending is a per-platform capability, not guaranteed by the base Platform interface.","triggerScenarios":"Calling the engine send API with len(images)>0 against a platform adapter (e.g. one lacking card/image upload support) whose concrete type does not satisfy core.ImageSender.","commonSituations":"Switching a bot to a platform that only supports plain text (e.g. a minimal custom adapter, or an older platform plugin predating image support); config pointing a session at a different platform type than the code assumes.","solutions":["Check the target platform implements core.ImageSender before sending images (capability check via type assertion)","Remove image attachments from the request for that platform","Upgrade or fix the platform adapter to implement SendImage / the ImageSender interface"],"exampleFix":"// before\nengine.SendToSession(key, msg, imgs, nil, \"\", nil, false) // panics into ErrNotSupported on text-only platform\n// after\nif _, ok := platform.(core.ImageSender); !ok {\n    imgs = nil // or send a download link as text\n}\nengine.SendToSession(key, msg, imgs, nil, \"\", nil, false)","handlingStrategy":"type-guard","validationCode":"if _, ok := platform.(core.ImageSender); !ok { /* strip images or error early */ }","typeGuard":"func supportsImages(p core.Platform) bool { _, ok := p.(core.ImageSender); return ok }","tryCatchPattern":"if err := engine.SendToSession(...); err != nil {\n    var nsErr = core.ErrNotSupported\n    if errors.Is(err, nsErr) { log.Warn(\"platform lacks image support; falling back to text\") }\n}","preventionTips":["Always capability-check optional interfaces before using rich-media APIs","Document per-platform media support in your deployment config","Prefer graceful degradation (link in text) over hard failure"],"tags":["go","capability","images","platform"],"backgroundTag":"unsupported-operation","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}