MPD
MPD copied to clipboard
"what(): invalid utf8" when starting MPD on Windows 10 x64
First and foremost, thank you for the amazing work on this great program that I've been using for almost a decade now!
I get this error when I try to start MPD. I couldn't use the latest version because of the libwinpthread-1.dll bug, so I had to use the previous one. It happens when I specify a real config file (as pasted below) or a non-existant file, but not when I use "--no-config".
Version
Music Player Daemon 0.24.2 (0.24.2)
Copyright 2003-2007 Warren Dukes <[email protected]>
Copyright 2008-2025 Max Kellermann <[email protected]>
This is free software; see the source for copying conditions. There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Database plugins:
simple proxy
Storage plugins:
local nfs
Decoder plugins:
[vorbis] ogg oga
[oggflac] ogg oga
[flac] flac
[opus] opus ogg oga
[dsdiff] dff
[dsf] dsf
[openmpt] mptm mod s3m xm it 669 amf ams c67 dbm digi dmf dsm dtm far imf ice j2b m15 mdl med mms mt2 mtm nst okt plm psm pt36 ptm sfx sfx2 st26 stk stm stp ult wow gdm mo3 oxm umx xpk ppm mmcmp
[modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm
[wildmidi] mid
[gme] ay gbs gym hes kss nsf nsfe rsn sap spc vgm vgz
[ffmpeg] 265 266 302 3g2 3gp 4xm 722 aa aa3 aac aax ac3 ac4 ace acm act adf adp ads adx aea afc aiff aix al alp amr amrnb amrwb anm ans apc ape apl apm apng aptx aptxhd argo_asf argo_brp argo_cvg art asc asf asf_o ast au avi avif avr av
s avs2 avs3 bcstm bfi bfstm bin binka bit bitpacked bmv boa bonk brstm c2 c93 caf cdata cdg cgi cine codec2raw concat dat data daud dav dfa dff dfpwm dif dirac diz dnxhd dsf dsicin dss dst dtk dts dtshd dv dxa ea eac3 ec3 evc f32be f32le
f4v f64be f64le fap ffmetadata film_cpk fits flic flm flv frm fsb fwse g722 g723_1 g726 g726le g729 gdv genh gif gsm gxf h265 h266 hca hcom hdr_pipe heic heif hevc hls hnm iamf ice idcin idf iff ifv ilbc imx ipmovie ipu ircam ism isma i
smv iss iv8 ivf ivr jv jxl kux kvag laf lc3 lmlm4 loas lvf lxf m2a m4a m4b m4v mac mca mcc mgsts mj2 mjpg mk3d mka mks mkv mlv mm mmf mods moflex mov mp2 mp3 mp4 mpa mpc mpc8 mpegts mpegtsraw msbc msf msnwctcp msp mtaf mtv musx mv mvi mx
f mxg nfo nist nsp nsv nut nuv ogg oma omg osq paf pdv pmp pp_bnk psp psxstr pva pvf qcp qoa r3d rco rcv rcwt rka rl2 rm roq rpl rsd rso s16be s24be s24le s32be s32le s337m sb sbc sbg scd sdns sdr2 sds sdx ser sf sga shn sln smk smush so
l son sox spdif sph ss2 str sup svag svs sw tak tco thp tiertexseq tmv tta txd txt ty ty+ u16be u24be u24le u32be u32le ub ul usm uw v v210 vag vb vc1 vidc viv vividas vmd voc vpk vqe vqf vql vt vvc w64 wa wav way wc3movie webm wsaud wsd
wsvqa wtv wv wve xa xbin xmd xmv xvag xwma yop yuv10
[sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
[pcm]
Filters:
libsamplerate
Tag plugins:
Output plugins:
null httpd snapcast recorder winmm wasapi
Encoder plugins:
null vorbis opus lame wave flac
Input plugins:
file ffmpeg nfs
Playlist plugins:
extm3u m3u pls xspf asx rss flac cue embcue
Protocols:
nfs://
Other features:
ipv6 tcp
Configuration
music_directory "C:/Users/sylsau/Sync/PC/Musique"
playlist_directory "C:/Users/sylsau/Sync/PC/Musique/Playlists"
db_file "C:/Users/sylsau/mpd/db.mpd"
log_file "C:/Users/sylsau/mpd/log.mpd"
pid_file "C:/Users/sylsau/mpd/pid.mpd"
state_file "C:/Users/sylsau/mpd/state.mpd"
sticker_file "C:/Users/sylsau/mpd/sticker.sql.mpd"
log_level "secure"
bind_to_address "localhost"
port "6600" # default 6600
# Allow for controlling volume through MPD directly, and not through the output device (speakers, etc.)
mixer_type "software"
filesystem_charset "UTF-8"
save_absolute_paths_in_playlists "no"
audio_output {
type "winmm"
name "WinMM"
enabled "yes"
}
audio_output {
type "wasapi"
name "Wasapi"
enabled "yes"
}
audio_output {
type "httpd"
enabled "yes"
name "LDLC-ART-SS flux audio Windows (port 8000)"
port "8000" # NB : en conflit avec WSL !
format "44100:16:2"
max_clients "0" # optional 0=no limit
always_on "yes" # do not close at end of playback
encoder "lame"
#quality "0" # do not define if bitrate is defined
bitrate "320" # do not define if quality is defined
tags "yes" # send tags to listening streams
}
MPD output
$ ./mpd-0.24.2d.exe mpd.conf --stderr --no-daemon --verbose
config_file: loading file "mpd.conf"
terminate called after throwing an instance of 'std::runtime_error'
what(): invalid utf8
$ ./mpd-0.24.2d.exe DOES_NOT_EXIST --stderr --no-daemon --verbose
config_file: loading file "DOES_NOT_EXIST"
terminate called after throwing an instance of 'std::runtime_error'
what(): invalid utf8
Log
Here's the output of windbg :
CommandLine: C:\Users\sylsau\mpd\mpd-0.24.2d.exe mpd.conf --stderr --no-daemon --verbose
Starting directory: C:\Users\sylsau\mpd
************* Path validation summary **************
Response Time (ms) Location
Deferred srv*
Symbol search path is: srv*
Executable search path is:
ModLoad: 00007ff7`a8030000 00007ff7`b7bf3000 mpd.exe
ModLoad: 00007ff9`9c210000 00007ff9`9c408000 ntdll.dll
ModLoad: 00007ff9`9b5a0000 00007ff9`9b662000 C:\Windows\System32\KERNEL32.DLL
ModLoad: 00007ff9`99f40000 00007ff9`9a236000 C:\Windows\System32\KERNELBASE.dll
ModLoad: 00007ff9`9b240000 00007ff9`9b2ef000 C:\Windows\System32\ADVAPI32.dll
ModLoad: 00007ff9`9a450000 00007ff9`9a4ee000 C:\Windows\System32\msvcrt.dll
ModLoad: 00007ff9`9a5a0000 00007ff9`9a63f000 C:\Windows\System32\sechost.dll
ModLoad: 00007ff9`9ade0000 00007ff9`9af03000 C:\Windows\System32\RPCRT4.dll
ModLoad: 00007ff9`998e0000 00007ff9`99907000 C:\Windows\System32\bcrypt.dll
ModLoad: 00007ff9`9b670000 00007ff9`9bdde000 C:\Windows\System32\SHELL32.dll
ModLoad: 00007ff9`99b80000 00007ff9`99c1d000 C:\Windows\System32\msvcp_win.dll
ModLoad: 00007ff9`99e40000 00007ff9`99f40000 C:\Windows\System32\ucrtbase.dll
ModLoad: 00007ff9`9b3d0000 00007ff9`9b56d000 C:\Windows\System32\USER32.dll
ModLoad: 00007ff9`998b0000 00007ff9`998d2000 C:\Windows\System32\win32u.dll
ModLoad: 00007ff9`9b210000 00007ff9`9b23b000 C:\Windows\System32\GDI32.dll
ModLoad: 00007ff9`99c20000 00007ff9`99d3a000 C:\Windows\System32\gdi32full.dll
ModLoad: 00007ff9`9a6b0000 00007ff9`9a705000 C:\Windows\System32\SHLWAPI.dll
ModLoad: 00007ff9`9a7c0000 00007ff9`9a82b000 C:\Windows\System32\WS2_32.dll
ModLoad: 00007ff9`925d0000 00007ff9`925f7000 C:\Windows\SYSTEM32\WINMM.dll
ModLoad: 00007ff9`9b030000 00007ff9`9b15b000 C:\Windows\System32\ole32.dll
ModLoad: 00007ff9`9be70000 00007ff9`9c1c3000 C:\Windows\System32\combase.dll
(1f68.3bf0): Break instruction exception - code 80000003 (first chance)
ntdll!LdrpDoDebuggerBreak+0x30:
00007ff9`9c2e07a0 cc int 3
0:000> g
ModLoad: 00007ff9`9b570000 00007ff9`9b59f000 C:\Windows\System32\IMM32.DLL
(1f68.3bf0): Unknown exception - code 00000005 (first chance)
Invalid parameter passed to C runtime function.
ModLoad: 00007ff9`98ff0000 00007ff9`9905c000 C:\Windows\system32\mswsock.dll
ModLoad: 00007ff9`98cf0000 00007ff9`98dba000 C:\Windows\SYSTEM32\DNSAPI.dll
ModLoad: 00007ff9`98c90000 00007ff9`98ccb000 C:\Windows\SYSTEM32\IPHLPAPI.DLL
ModLoad: 00007ff9`9add0000 00007ff9`9add8000 C:\Windows\System32\NSI.dll
ModLoad: 00007ff9`8e900000 00007ff9`8e90a000 C:\Windows\System32\rasadhlp.dll
ModLoad: 00007ff9`8e810000 00007ff9`8e890000 C:\Windows\System32\fwpuclnt.dll
(1f68.3bf0): Unknown exception - code 20474343 (first chance)
(1f68.3bf0): Unknown exception - code 20474343 (first chance)
(1f68.3bf0): Unknown exception - code 20474343 (first chance)
(1f68.3bf0): Unknown exception - code 20474343 (first chance)
ntdll!NtTerminateProcess+0x14:
00007ff9`9c2ada74 c3 ret
0:000> k
# Child-SP RetAddr Call Site
00 00000013`ea3fa638 00007ff9`9c26ef88 ntdll!NtTerminateProcess+0x14
01 00000013`ea3fa640 00007ff9`9b5be3eb ntdll!RtlExitUserProcess+0xb8
02 00000013`ea3fa670 00007ff9`9a48a155 KERNEL32!ExitProcessImplementation+0xb
03 00000013`ea3fa6a0 00007ff9`9a48a7c5 msvcrt!_crtExitProcess+0x15
04 00000013`ea3fa6d0 00007ff9`9a47f26d msvcrt!doexit+0x171
05 00000013`ea3fa740 00007ff7`a861e676 msvcrt!abort+0x8d
06 00000013`ea3facf0 00007ff7`a856dd96 mpd!XML_UseParserAsHandlerArg+0x104756
07 00000013`ea3fad40 00007ff7`a89623ae mpd!XML_UseParserAsHandlerArg+0x53e76
08 00000013`ea3fad70 00007ff7`a856e298 mpd!opus_strerror+0x15364e
09 00000013`ea3fada0 00007ff7`a84d2551 mpd!XML_UseParserAsHandlerArg+0x54378
0a 00000013`ea3faee0 00007ff7`a8726e95 mpd!gme_load_m3u+0x24b881
0b 00000013`ea3faf80 00007ff9`9c2b28bf mpd!XML_UseParserAsHandlerArg+0x20cf75
0c 00000013`ea3fafc0 00007ff9`9c262554 ntdll!RtlpExecuteHandlerForException+0xf
0d 00000013`ea3faff0 00007ff9`9c2b13ce ntdll!RtlDispatchException+0x244
0e 00000013`ea3fb700 00007ff9`99f7af29 ntdll!KiUserExceptionDispatch+0x2e
0f 00000013`ea3fbe00 00007ff7`a84d2611 KERNELBASE!RaiseException+0x69
10 00000013`ea3fbee0 00007ff7`a8726d19 mpd!gme_load_m3u+0x24b941
11 00000013`ea3fbf10 00007ff7`a85bd22f mpd!XML_UseParserAsHandlerArg+0x20cdf9
12 00000013`ea3fbf50 00007ff7`a85bd6b4 mpd!XML_UseParserAsHandlerArg+0xa330f
13 00000013`ea3fc0a0 00007ff7`a85c6124 mpd!XML_UseParserAsHandlerArg+0xa3794
14 00000013`ea3fc510 00007ff7`a85b6f0b mpd!XML_UseParserAsHandlerArg+0xac204
15 00000013`ea3fc590 00007ff7`a85cd4ae mpd!XML_UseParserAsHandlerArg+0x9cfeb
16 00000013`ea3fc810 00007ff7`a85497ec mpd!XML_UseParserAsHandlerArg+0xb358e
17 00000013`ea3fc860 00007ff7`a85499c4 mpd!XML_UseParserAsHandlerArg+0x2f8cc
18 00000013`ea3fc990 00007ff7`a853f369 mpd!XML_UseParserAsHandlerArg+0x2faa4
19 00000013`ea3fca10 00007ff7`a8554855 mpd!XML_UseParserAsHandlerArg+0x25449
1a 00000013`ea3fcd00 00007ff7`a8550083 mpd!XML_UseParserAsHandlerArg+0x3a935
1b 00000013`ea3ff660 00007ff7`a854cf39 mpd!XML_UseParserAsHandlerArg+0x36163
1c 00000013`ea3ff8b0 00007ff7`a89332ba mpd!XML_UseParserAsHandlerArg+0x33019
1d 00000013`ea3ff8e0 00007ff7`a80312ee mpd!opus_strerror+0x12455a
1e 00000013`ea3ff930 00007ff7`a8031406 mpd+0x12ee
1f 00000013`ea3ff980 00007ff9`9b5b7374 mpd+0x1406
20 00000013`ea3ff9b0 00007ff9`9c25cc91 KERNEL32!BaseThreadInitThunk+0x14
21 00000013`ea3ff9e0 00000000`00000000 ntdll!RtlUserThreadStart+0x21
0:000> !analyze -v
Last event: 1f68.3bf0: Exit process 0:1f68, code 3
debugger time: Mon May 19 23:50:59.536 2025 (UTC + 2:00)
Thank you for your work.
I have never used windbg (I havn't used Windows in nearly 30 years). Is the part after the "k" supposed to be the stack trace? Because it doesn't make any sense and is impossible. Sorry, I can't work with that data.
Duplicate of https://github.com/MusicPlayerDaemon/MPD/issues/2247
It seems that in src/lib/fmt/SystemError.cxx, calling FormatMessageA with non-latin charset will retrieve non-utf8 multi-bytes sequence strings after utf8 string inside buffer variable.
Should use FormatMessageW and convert to utf8 instead.
Seems that std::system_category::message also returns non-utf8 multi-bytes string before this pr: https://github.com/microsoft/STL/pull/5104
reference: https://github.com/microsoft/STL/issues/4711
Okay, a usual Microsoft fuckup. But who throws the exception?
Okay, a usual Microsoft fuckup. But who throws the exception?
It's from fmt, inside the function utf8_to_utf16