{"record":{"id":"9ed8f5e818576b2e","repo":"chenhg5/cc-connect","slug":"ffmpeg-not-found-w","errorCode":null,"errorMessage":"ffmpeg not found: %w","messagePattern":"ffmpeg not found: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/dingtalk/dingtalk.go","lineNumber":1312,"sourceCode":"}\n\n// compressAudio compresses audio if it exceeds size limits.\n// Uses ffmpeg to convert WAV to MP3 format (DingTalk supported, ~10:1 compression ratio).\nfunc (p *Platform) compressAudio(ctx context.Context, audio []byte, format string) ([]byte, string, error) {\n\t// Only WAV format can be compressed to MP3\n\tif strings.ToLower(format) != \"wav\" {\n\t\treturn nil, \"\", fmt.Errorf(\"only WAV format can be compressed, got: %s\", format)\n\t}\n\n\treturn p.compressAudioWithFFmpeg(ctx, audio, format)\n}\n\n// compressAudioWithFFmpeg compresses audio using ffmpeg with stdin/stdout pipes.\n// Converts WAV to MP3 format (64 kbps for voice).\nfunc (p *Platform) compressAudioWithFFmpeg(ctx context.Context, audio []byte, format string) ([]byte, string, error) {\n\tffmpegPath, err := exec.LookPath(\"ffmpeg\")\n\tif err != nil {\n\t\treturn nil, \"\", fmt.Errorf(\"ffmpeg not found: %w\", err)\n\t}\n\n\targs := []string{\n\t\t\"-i\", \"pipe:0\",\n\t\t\"-ar\", \"16000\", // 16kHz sample rate for voice\n\t\t\"-ac\", \"1\", // mono\n\t\t\"-b:a\", \"64k\", // 64 kbps bitrate (voice quality)\n\t\t\"-f\", \"mp3\",\n\t\t\"-y\",\n\t\t\"pipe:1\",\n\t}\n\tcmd := exec.CommandContext(ctx, ffmpegPath, args...)\n\tcmd.Stdin = bytes.NewReader(audio)\n\tvar stdout, stderr bytes.Buffer\n\tcmd.Stdout = &stdout\n\tcmd.Stderr = &stderr\n\n\tif err := cmd.Run(); err != nil {","sourceCodeStart":1294,"sourceCodeEnd":1330,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/dingtalk/dingtalk.go#L1294-L1330","documentation":"This error means the ffmpeg binary could not be located on PATH (exec.LookPath failed), so WAV→MP3 compression cannot run. The DingTalk voice pipeline depends on an external ffmpeg installation; the library does not bundle it.","triggerScenarios":"compressAudio → compressAudioWithFFmpeg runs exec.LookPath(\"ffmpeg\") and ffmpeg is not installed, not in PATH, or lacks the execute bit.","commonSituations":"Deploying the cc-connect binary in a minimal Docker image or systemd service with a stripped PATH; ffmpeg installed under a non-PATH directory; running the daemon as a user whose PATH differs from the shell user's.","solutions":["Install ffmpeg (apt-get install ffmpeg / brew install ffmpeg / apk add ffmpeg).","Ensure the directory containing ffmpeg is in PATH for the daemon user; for systemd add Environment=PATH=... to the unit.","Symlink or copy the binary into a standard PATH location such as /usr/local/bin.","Verify with `which ffmpeg` as the same user the daemon runs as."],"exampleFix":"// systemd unit before\n[Service]\nExecStart=/usr/local/bin/cc-connect\n// after\n[Service]\nEnvironment=PATH=/usr/local/bin:/usr/bin:/bin\nExecStart=/usr/local/bin/cc-connect","handlingStrategy":"fallback","validationCode":"// Pre-flight at startup\nif _, err := exec.LookPath(\"ffmpeg\"); err != nil {\n    slog.Warn(\"ffmpeg missing; voice compression disabled\", \"err\", err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add ffmpeg to the deployment image/Dockerfile and to systemd PATH.","Run a doctor/startup check that warns when ffmpeg is absent.","Document ffmpeg as an optional dependency for the DingTalk voice feature."],"tags":["dingtalk","ffmpeg","external-dependency","audio"],"backgroundTag":"missing-optional-dependency","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"}