If no processes are running and the keyserver is not specified (or the configuration is wrong), the first keyserver search fails silently. On the second try the error (e.g. No keyserver available) is shown:
C:\Users\g10>gpg --version gpg (GnuPG) 2.5.16 libgcrypt 1.11.2 C:\Users\g10>taskkill /IM "keyboxd.exe" /IM "gpg-agent.exe" /IM "okular.exe" /IM "dirmngr.exe" /IM "gpgsm.exe" /IM "kleopatra.exe" /F 1>nul 2>&1 C:\Users\g10>gpg -v --debug-all --search-keys test gpg: reading options from 'C:/Users/g10/AppData/Roaming/gnupg/gpg.conf' gpg: reading options from '[cmdline]' gpg: reading options from 'C:/Users/g10/AppData/Roaming/gnupg/common.conf' gpg: enabled debug flags: packet mpi crypto filter iobuf memory cache memstat trust hashing ipc recsel clock lookup extprog keydb gpg: enabled compatibility flags: gpg: DBG: [no clock] start gpg: no running dirmngr - starting 'C:\\Program Files\\Gpg4win\\..\\GnuPG\\bin\\dirmngr.exe' C:\Users\g10>gpg -v --search-keys test gpg: enabled compatibility flags: gpg: error searching keyserver: No keyserver available gpg: keyserver search failed: No keyserver available
gpg log (note: gpg does not output the above error to stdout, if log-file is specified)
[ FIRST TRY ]
2026-01-05 13:34:37 gpg[7320] enabled debug flags: packet mpi crypto filter iobuf memory cache memstat trust hashing ipc recsel clock lookup extprog keydb
2026-01-05 13:34:37 gpg[7320] enabled compatibility flags:
2026-01-05 13:34:37 gpg[7320] DBG: [no clock] start
2026-01-05 13:34:39 gpg[7320] no running dirmngr - starting 'C:\\Program Files\\Gpg4win\\..\\GnuPG\\bin\\dirmngr.exe'
2026-01-05 13:34:45 gpg[7320] waiting for the dirmngr to come up ... (8s)
2026-01-05 13:34:45 gpg[7320] DBG: chan_0x0000000000000254 <- # Home: C:\Users\g10\AppData\Roaming\gnupg
2026-01-05 13:34:45 gpg[7320] DBG: chan_0x0000000000000254 <- # Config: C:/Users/g10/AppData/Roaming/gnupg/dirmngr.conf
2026-01-05 13:34:45 gpg[7320] DBG: chan_0x0000000000000254 <- OK Dirmngr 2.5.16 at your service, process 3412
2026-01-05 13:34:45 gpg[7320] connection to the dirmngr established
2026-01-05 13:34:45 gpg[7320] DBG: chan_0x0000000000000254 -> GETINFO version
2026-01-05 13:34:45 gpg[7320] DBG: chan_0x0000000000000254 <- D 2.5.16
2026-01-05 13:34:45 gpg[7320] DBG: chan_0x0000000000000254 <- OK
2026-01-05 13:34:45 gpg[7320] DBG: chan_0x0000000000000254 -> KS_SEARCH -- test
2026-01-05 13:34:45 gpg[7320] DBG: chan_0x0000000000000254 <- ERR 167772346 No keyserver available <Dirmngr>
2026-01-05 13:34:45 gpg[7320] error searching keyserver: No keyserver available
2026-01-05 13:34:45 gpg[7320] keyserver search failed: No keyserver available
2026-01-05 13:34:45 gpg[7320] DBG: chan_0x0000000000000254 -> BYE
2026-01-05 13:34:45 gpg[7320] DBG: [no clock] stop
2026-01-05 13:34:45 gpg[7320] keydb: handles=0 locks=0 parse=0 get=0
2026-01-05 13:34:45 gpg[7320] build=0 update=0 insert=0 delete=0
2026-01-05 13:34:45 gpg[7320] reset=0 found=0 not=0 cache=0 not=0
2026-01-05 13:34:45 gpg[7320] kid_not_found_cache: count=0 peak=0 flushes=0
2026-01-05 13:34:45 gpg[7320] sig_cache: total=0 cached=0 good=0 bad=0
2026-01-05 13:34:45 gpg[7320] objcache: keys=0/0/0 chains=0,0..0 buckets=0/0 attic=0
2026-01-05 13:34:45 gpg[7320] objcache: uids=0/0/0 chains=0,0..0 buckets=0/0
2026-01-05 13:34:45 gpg[7320] random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
outmix=0 getlvl1=0/0 getlvl2=0/0
2026-01-05 13:34:45 gpg[7320] rndjent stat: collector=0x0000000000000000 calls=0 bytes=0
2026-01-05 13:34:45 gpg[7320] secmem usage: 0/32768 bytes in 0 blocks
[ SECOND TRY ]
2026-01-05 13:34:49 gpg[9192] enabled debug flags: packet mpi crypto filter iobuf memory cache memstat trust hashing ipc recsel clock lookup extprog keydb
2026-01-05 13:34:49 gpg[9192] enabled compatibility flags:
2026-01-05 13:34:49 gpg[9192] DBG: [no clock] start
2026-01-05 13:34:49 gpg[9192] DBG: chan_0x0000000000000240 <- # Home: C:\Users\g10\AppData\Roaming\gnupg
2026-01-05 13:34:49 gpg[9192] DBG: chan_0x0000000000000240 <- # Config: C:/Users/g10/AppData/Roaming/gnupg/dirmngr.conf
2026-01-05 13:34:49 gpg[9192] DBG: chan_0x0000000000000240 <- OK Dirmngr 2.5.16 at your service, process 3412
2026-01-05 13:34:49 gpg[9192] DBG: connection to the dirmngr established
2026-01-05 13:34:49 gpg[9192] DBG: chan_0x0000000000000240 -> GETINFO version
2026-01-05 13:34:49 gpg[9192] DBG: chan_0x0000000000000240 <- D 2.5.16
2026-01-05 13:34:49 gpg[9192] DBG: chan_0x0000000000000240 <- OK
2026-01-05 13:34:49 gpg[9192] DBG: chan_0x0000000000000240 -> KS_SEARCH -- test
2026-01-05 13:34:49 gpg[9192] DBG: chan_0x0000000000000240 <- ERR 167772346 No keyserver available <Dirmngr>
2026-01-05 13:34:49 gpg[9192] error searching keyserver: No keyserver available
2026-01-05 13:34:49 gpg[9192] keyserver search failed: No keyserver available
2026-01-05 13:34:49 gpg[9192] DBG: chan_0x0000000000000240 -> BYE
2026-01-05 13:34:49 gpg[9192] DBG: [no clock] stop
2026-01-05 13:34:49 gpg[9192] keydb: handles=0 locks=0 parse=0 get=0
2026-01-05 13:34:49 gpg[9192] build=0 update=0 insert=0 delete=0
2026-01-05 13:34:49 gpg[9192] reset=0 found=0 not=0 cache=0 not=0
2026-01-05 13:34:49 gpg[9192] kid_not_found_cache: count=0 peak=0 flushes=0
2026-01-05 13:34:49 gpg[9192] sig_cache: total=0 cached=0 good=0 bad=0
2026-01-05 13:34:49 gpg[9192] objcache: keys=0/0/0 chains=0,0..0 buckets=0/0 attic=0
2026-01-05 13:34:49 gpg[9192] objcache: uids=0/0/0 chains=0,0..0 buckets=0/0
2026-01-05 13:34:49 gpg[9192] random usage: poolsize=600 mixed=0 polls=0/0 added=0/0
outmix=0 getlvl1=0/0 getlvl2=0/0
2026-01-05 13:34:49 gpg[9192] rndjent stat: collector=0x0000000000000000 calls=0 bytes=0
2026-01-05 13:34:49 gpg[9192] secmem usage: 0/32768 bytes in 0 blocksdirmngr log:
[ FIRST TRY ] 2026-01-05 13:34:45 dirmngr[3412] listening on socket 'C:\\Users\\g10\\AppData\\Local\\gnupg\\S.dirmngr' 2026-01-05 13:34:45 dirmngr[3412] error loading certificate 'ROOT': Certificate expired 2026-01-05 13:34:45 dirmngr[3412] error loading certificate 'ROOT': Certificate expired 2026-01-05 13:34:45 dirmngr[3412] error loading certificate 'ROOT': Certificate expired 2026-01-05 13:34:45 dirmngr[3412] error loading certificate 'ROOT': Certificate expired 2026-01-05 13:34:45 dirmngr[3412] error loading certificate 'ROOT': Certificate expired 2026-01-05 13:34:45 dirmngr[3412] error loading certificate 'ROOT': Certificate expired 2026-01-05 13:34:45 dirmngr[3412] error loading certificate 'ROOT': Certificate expired 2026-01-05 13:34:45 dirmngr[3412] DBG: number of certs loaded from store 'ROOT': 27 2026-01-05 13:34:45 dirmngr[3412] error loading certificate 'CA': Certificate expired 2026-01-05 13:34:45 dirmngr[3412] error loading certificate 'CA': Certificate expired 2026-01-05 13:34:45 dirmngr[3412] DBG: number of certs loaded from store 'CA': 1 2026-01-05 13:34:45 dirmngr[3412] permanently loaded certificates: 28 2026-01-05 13:34:45 dirmngr[3412] runtime cached certificates: 0 2026-01-05 13:34:45 dirmngr[3412] trusted certificates: 28 (28,0,0,0) 2026-01-05 13:34:45 dirmngr[3412] handler for fd 724 started 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 -> # Home: C:\Users\g10\AppData\Roaming\gnupg 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 -> # Config: C:/Users/g10/AppData/Roaming/gnupg/dirmngr.conf 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 -> OK Dirmngr 2.5.16 at your service, process 3412 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 <- GETINFO version 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 -> D 2.5.16 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 -> OK 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 <- KS_SEARCH -- test 2026-01-05 13:34:45 dirmngr[3412] command 'KS_SEARCH' failed: No keyserver available 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 -> ERR 167772346 No keyserver available <Dirmngr> 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 <- BYE 2026-01-05 13:34:45 dirmngr[3412] DBG: chan_0x00000000000002d4 -> OK closing connection 2026-01-05 13:34:45 dirmngr[3412] handler for fd 724 terminated [ SECOND TRY ] 2026-01-05 13:34:49 dirmngr[3412] handler for fd 740 started 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 -> # Home: C:\Users\g10\AppData\Roaming\gnupg 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 -> # Config: C:/Users/g10/AppData/Roaming/gnupg/dirmngr.conf 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 -> OK Dirmngr 2.5.16 at your service, process 3412 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 <- GETINFO version 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 -> D 2.5.16 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 -> OK 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 <- KS_SEARCH -- test 2026-01-05 13:34:49 dirmngr[3412] command 'KS_SEARCH' failed: No keyserver available 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 -> ERR 167772346 No keyserver available <Dirmngr> 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 <- BYE 2026-01-05 13:34:49 dirmngr[3412] DBG: chan_0x00000000000002e4 -> OK closing connection 2026-01-05 13:34:49 dirmngr[3412] handler for fd 740 terminated