{"record":{"id":"255d20c97f8039b9","repo":"chenhg5/cc-connect","slug":"wps-agentspace-sendfile-invalid-reply-context-ty","errorCode":null,"errorMessage":"wps-agentspace: SendFile: invalid reply context type %T","messagePattern":"wps-agentspace: SendFile: invalid reply context type %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/wps-agentspace/wpsagentspace.go","lineNumber":222,"sourceCode":"\treturn p.sendText(rc.ChatID, content, rc)\n}\n\n// Send sends a message to a chat.\nfunc (p *Platform) Send(ctx context.Context, replyCtx any, content string) error {\n\trc, ok := replyCtx.(*replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"wps-agentspace: invalid reply context type\")\n\t}\n\treturn p.sendText(rc.ChatID, content, rc)\n}\n\n// SendFile implements core.FileSender. The WPS Agentspace WebSocket protocol\n// has no native binary file frame, so we persist the file to a shared\n// directory and reply with a path the user can open locally.\nfunc (p *Platform) SendFile(ctx context.Context, replyCtx any, file core.FileAttachment) error {\n\trc, ok := replyCtx.(*replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"wps-agentspace: SendFile: invalid reply context type %T\", replyCtx)\n\t}\n\n\tpath, err := p.saveAttachment(file.FileName, file.Data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"wps-agentspace: SendFile: %w\", err)\n\t}\n\n\tnotice := fmt.Sprintf(\"📎 文件已保存到本地：\\n%s\", path)\n\treturn p.sendText(rc.ChatID, notice, rc)\n}\n\n// SendImage implements core.ImageSender. Same disk-persist fallback as SendFile.\nfunc (p *Platform) SendImage(ctx context.Context, replyCtx any, img core.ImageAttachment) error {\n\trc, ok := replyCtx.(*replyContext)\n\tif !ok {\n\t\treturn fmt.Errorf(\"wps-agentspace: SendImage: invalid reply context type %T\", replyCtx)\n\t}\n","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/wps-agentspace/wpsagentspace.go#L204-L240","documentation":"Type-assertion guard in wps-agentspace SendFile: replyCtx is not the platform's *replyContext type, so the target ChatID for the persisted-file notice cannot be determined.","triggerScenarios":"Thrown at platform/wps-agentspace/wpsagentspace.go:222 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure callers forward the platform-owned *replyContext","Add reconstruction support so non-reply flows obtain a valid context"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}