{"record":{"id":"16faa5e73e4ead25","repo":"chenhg5/cc-connect","slug":"platform-s-does-not-support-audio-sending","errorCode":null,"errorMessage":"platform %s does not support audio sending","messagePattern":"platform (.+?) does not support audio sending","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":15879,"sourceCode":"\tslog.Debug(\"tts: sendTTSReply called\", \"platform\", p.Name(), \"text_len\", len(text))\n\tif err := e.synthesizeAndSendTTS(p, replyCtx, text); err != nil {\n\t\tslog.Error(\"tts: voice reply failed\", \"platform\", p.Name(), \"error\", err)\n\t}\n}\n\nfunc (e *Engine) synthesizeAndSendTTS(p Platform, replyCtx any, text string) error {\n\tif e.tts == nil || !e.tts.Enabled {\n\t\treturn fmt.Errorf(\"tts is not configured\")\n\t}\n\tif e.tts.TTS == nil {\n\t\treturn fmt.Errorf(\"tts provider is not configured\")\n\t}\n\tif e.tts.MaxTextLen > 0 && utf8.RuneCountInString(text) > e.tts.MaxTextLen {\n\t\treturn fmt.Errorf(\"text exceeds max_text_len (%d > %d)\", utf8.RuneCountInString(text), e.tts.MaxTextLen)\n\t}\n\tas, ok := p.(AudioSender)\n\tif !ok {\n\t\treturn fmt.Errorf(\"platform %s does not support audio sending\", p.Name())\n\t}\n\tslog.Info(\"tts: starting synthesis\", \"voice\", e.tts.Voice, \"speed\", e.tts.Speed, \"text_len\", len(text))\n\topts := TTSSynthesisOpts{\n\t\tVoice:        e.tts.Voice,\n\t\tLanguageType: e.tts.LanguageType,\n\t\tSpeed:        e.tts.Speed,\n\t}\n\taudioData, format, err := e.tts.TTS.Synthesize(e.ctx, StripMarkdown(text), opts)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"synthesize: %w\", err)\n\t}\n\tslog.Info(\"tts: synthesis successful\", \"format\", format, \"audio_size\", len(audioData))\n\tif err := as.SendAudio(e.ctx, replyCtx, audioData, format); err != nil {\n\t\treturn fmt.Errorf(\"send audio: %w\", err)\n\t}\n\tslog.Info(\"tts: audio sent successfully\", \"platform\", p.Name())\n\treturn nil\n}","sourceCodeStart":15861,"sourceCodeEnd":15897,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L15861-L15897","documentation":"After TTS config validation passes, synthesizeAndSendTTS checks whether the target platform implements the optional AudioSender capability interface. If it does not, the engine cannot deliver audio to that platform and returns this error naming the platform.","triggerScenarios":"Requesting a voice/TTS reply routed to a platform adapter that lacks the AudioSender implementation, e.g. sending TTS output through a text-only platform adapter.","commonSituations":"Using a platform that only supports text messages (no audio message API) while voice replies are enabled; a platform adapter version that predates audio support.","solutions":["Use a platform that supports audio messages (implements AudioSender, e.g. Feishu/Telegram) for voice replies","Upgrade the platform adapter to a version implementing AudioSender","Disable voice replies and fall back to text for platforms without audio support","Add AudioSender support to a custom platform adapter"],"exampleFix":"// before — custom platform without audio\nfunc (p *Platform) Reply(...) error { /* text only */ }\n// after\nfunc (p *Platform) SendAudio(ctx context.Context, replyCtx any, data []byte, mime string) error { /* implement audio upload */ }","handlingStrategy":"type-guard","validationCode":"if _, ok := platform.(core.AudioSender); !ok {\n    reply(\"voice replies are not supported on this platform; sending text instead\")\n    return\n}","typeGuard":"func supportsAudio(p core.Platform) bool {\n    _, ok := p.(core.AudioSender)\n    return ok\n}","tryCatchPattern":"if err := e.SynthesizeAndSendTTS(p, replyCtx, text); err != nil {\n    if strings.Contains(err.Error(), \"does not support audio sending\") {\n        slog.Warn(\"platform lacks AudioSender; falling back to text\", \"platform\", p.Name())\n        p.Reply(replyCtx, text)\n        return\n    }\n    return err\n}","preventionTips":["Gate voice-reply commands behind a capability check (AudioSender) per platform","Implement SendAudio in custom platform adapters if voice output is required","Upgrade platform adapters to versions that support audio messages","Test TTS on each target platform during deployment"],"tags":["tts","platform-capability","audio"],"backgroundTag":"unsupported-operation","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"}