chenhg5/cc-connect · error
pico2wave: voice=%s text=%q: %w, output: %s
Error message
pico2wave: voice=%s text=%q: %w, output: %s
What it means
PicoTTS.Synthesize executes pico2wave --lang=<voice> --wave=<tmpfile> <text> via CombinedOutput; this error is returned when the pico2wave process exits non-zero, wrapping the exec error and including the combined stdout+stderr output for diagnosis. Typical wrapped causes are *exec.ExitError from a bad --lang code or rejected text, or *exec.Error when the pico2wave binary itself cannot be found.
Source
Thrown at core/tts.go:640
}
tmpPath := tmpFile.Name()
tmpFile.Close()
defer os.Remove(tmpPath)
// Build pico2wave command
// --lang: language code (zh-CN for Chinese, en-US for English)
// --wave: output WAV file path
args := []string{
"--lang=" + voice,
"--wave=" + tmpPath,
text,
}
// Execute pico2wave command
cmd := exec.CommandContext(ctx, p.Path, args...)
output, err := cmd.CombinedOutput()
if err != nil {
return nil, "", fmt.Errorf("pico2wave: voice=%s text=%q: %w, output: %s", voice, text, err, string(output))
}
// Read the generated WAV file
audioData, err := os.ReadFile(tmpPath)
if err != nil {
return nil, "", fmt.Errorf("pico2wave: read output file: %w", err)
}
if len(audioData) == 0 {
return nil, "", fmt.Errorf("pico2wave: produced empty audio file")
}
return audioData, "wav", nil
}
// ──────────────────────────────────────────────────────────────
// EdgeTTS — Microsoft Edge TTS (free, high quality, requires network)
// ──────────────────────────────────────────────────────────────View on GitHub (pinned to 4000b2338a)
Solutions
- Read the 'output:' portion of the error — it contains pico2wave's own message (e.g. 'Unknown language').
- Reproduce manually: pico2wave --lang=<voice> --wave=/tmp/t.wav "<text>" and inspect stderr.
- Verify the language code is one pico2wave supports with installed data (`pico2wave --lang=help` or check /usr/share/pico/lang); replace the zh-CN default with en-US or install a zh voice if your build provides one.
- Confirm pico2wave is installed (apt install libttspico-utils) and set PicoTTS.Path to the full binary path if it's not on PATH.
- Ensure text is non-empty and free of characters that break argument parsing.
Example fix
// before
pico := core.NewPicoTTS("", "zh-CN") // stock pico2wave has no zh-CN
// after
pico := core.NewPicoTTS("", "en-US") // verify with: pico2wave --lang=help
// or install/configure a pico zh voice package and keep zh-CN Defensive patterns
Strategy: validation
Validate before calling
// Go: validate pico2wave and the voice before use
p, err := exec.LookPath("pico2wave")
if err != nil { /* not installed: apt install libttspico-utils */ }
var validVoices = map[string]bool{
"en-US": true, "en-GB": true, "de-DE": true,
"es-ES": true, "fr-FR": true, "it-IT": true,
}
if !validVoices[voice] { /* pick a supported voice or install language data */ } Type guard
func picoVoiceSupported(voice string) bool {
switch voice {
case "en-US", "en-GB", "de-DE", "es-ES", "fr-FR", "it-IT":
return true
}
return false
} Try / catch
audio, format, err := pico.Synthesize(ctx, text, opts)
if err != nil {
var exitErr *exec.ExitError
if errors.As(err, &exitErr) {
// the error message already embeds CombinedOutput; log the full err
log.Printf("pico2wave failed: %v", err)
}
// fallback to espeak or cloud TTS
return espeak.Synthesize(ctx, text, opts)
} Prevention
- Validate the --lang code against pico2wave's installed voices at config load (stock builds lack zh-CN).
- Run `pico2wave --lang=help` or check /usr/share/pico/lang in setup/doctor tooling.
- Use exec.LookPath to confirm the binary exists before selecting PicoTTS.
- Keep text non-empty and strip control characters before synthesis.
When it happens
Trigger: Calling Synthesize via PicoTTS when: pico2wave is not installed or Path is wrong (exec: "pico2wave": executable file not found in $PATH); the language code is not among pico2wave's installed voices (stock pico2wave ships only en-US/en-GB/de-DE/es-ES/fr-FR/it-IT — the library's zh-CN default does not exist in stock builds); text contains characters pico2wave rejects; or the context deadline cancels the process.
Common situations: Fresh installs of libttspico-utils where the zh-CN default voice doesn't exist; missing SVOX Pico language data files; ARM/non-x86 hosts where pico isn't packaged; Voice configured with an espeak-style code ("zh+f3") that pico2wave doesn't understand; empty text argument.
Understand the failure class
Background: "git command failed": what it means when a tool shells out to git and git exits non-zero — this error's family across 21 libraries.
Related errors
- espeak: voice=%s text=%q: %w
- tts is not configured
- pico2wave: create temp file: %w
- pico2wave: read output file: %w
- pico2wave: produced empty audio file
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/5f60a714ce5d746e.
Report an issue: GitHub.