chenhg5/cc-connect · error

platform %s does not support audio sending

Error message

platform %s does not support audio sending

What it means

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.

Source

Thrown at core/engine.go:15879

	slog.Debug("tts: sendTTSReply called", "platform", p.Name(), "text_len", len(text))
	if err := e.synthesizeAndSendTTS(p, replyCtx, text); err != nil {
		slog.Error("tts: voice reply failed", "platform", p.Name(), "error", err)
	}
}

func (e *Engine) synthesizeAndSendTTS(p Platform, replyCtx any, text string) error {
	if e.tts == nil || !e.tts.Enabled {
		return fmt.Errorf("tts is not configured")
	}
	if e.tts.TTS == nil {
		return fmt.Errorf("tts provider is not configured")
	}
	if e.tts.MaxTextLen > 0 && utf8.RuneCountInString(text) > e.tts.MaxTextLen {
		return fmt.Errorf("text exceeds max_text_len (%d > %d)", utf8.RuneCountInString(text), e.tts.MaxTextLen)
	}
	as, ok := p.(AudioSender)
	if !ok {
		return fmt.Errorf("platform %s does not support audio sending", p.Name())
	}
	slog.Info("tts: starting synthesis", "voice", e.tts.Voice, "speed", e.tts.Speed, "text_len", len(text))
	opts := TTSSynthesisOpts{
		Voice:        e.tts.Voice,
		LanguageType: e.tts.LanguageType,
		Speed:        e.tts.Speed,
	}
	audioData, format, err := e.tts.TTS.Synthesize(e.ctx, StripMarkdown(text), opts)
	if err != nil {
		return fmt.Errorf("synthesize: %w", err)
	}
	slog.Info("tts: synthesis successful", "format", format, "audio_size", len(audioData))
	if err := as.SendAudio(e.ctx, replyCtx, audioData, format); err != nil {
		return fmt.Errorf("send audio: %w", err)
	}
	slog.Info("tts: audio sent successfully", "platform", p.Name())
	return nil
}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Use a platform that supports audio messages (implements AudioSender, e.g. Feishu/Telegram) for voice replies
  2. Upgrade the platform adapter to a version implementing AudioSender
  3. Disable voice replies and fall back to text for platforms without audio support
  4. Add AudioSender support to a custom platform adapter

Example fix

// before — custom platform without audio
func (p *Platform) Reply(...) error { /* text only */ }
// after
func (p *Platform) SendAudio(ctx context.Context, replyCtx any, data []byte, mime string) error { /* implement audio upload */ }
Defensive patterns

Strategy: type-guard

Validate before calling

if _, ok := platform.(core.AudioSender); !ok {
    reply("voice replies are not supported on this platform; sending text instead")
    return
}

Type guard

func supportsAudio(p core.Platform) bool {
    _, ok := p.(core.AudioSender)
    return ok
}

Try / catch

if err := e.SynthesizeAndSendTTS(p, replyCtx, text); err != nil {
    if strings.Contains(err.Error(), "does not support audio sending") {
        slog.Warn("platform lacks AudioSender; falling back to text", "platform", p.Name())
        p.Reply(replyCtx, text)
        return
    }
    return err
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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 chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/16faa5e73e4ead25. Report an issue: GitHub.