Two bugs when adding some pubkey in the keyring

Hello,

I have used my OnlyKey successfully for a long time now.
And I am mostly happy with it.

But I have just found last week two distinct but probably related bugs in the gpg-agent.

First when I add some new public keys from my freinds to my keyring with “gpg -import some_public_key.asc”

Most of them but not all are also listed when I type “gpg --list-secret-keys”.
I do not know why some do and some other don’t. But they should not as they are not secret keys and I do not have their associated secret keys.
This is just a very minor problem and I would not have even mentioned it if I didn’t think it may be related to the root cause of the second bug.

Then now the second one is more sever.
Every thing work fine until I import an 30th public key.
With 29 public keys all is right except the first minor bug.
With 30 public kyes in my keyring onlykey-gpg-agent refuse to sign, check, cipher or decipher anything.
And I have this error message:

“gpg: problem with fast path key listing: Line passed to IPC too long - ignored”

Plus in the $GNUPGHOME/gpg-agent.log I have this at the end:

```
2026-06-08 17:41:18,702 DEBUG parsed identity: {‘proto’: ‘gpg’, ‘user’: None, ‘host’: ‘’, ‘port’: None, ‘path’: None} [interface.py:30]
2026-06-08 17:41:18,707 DEBUG connected [client.py:246]
2026-06-08 17:41:18,708 DEBUG preparing payload for writing [client.py:298]
2026-06-08 17:41:18,708 DEBUG msg=OKSETTIME [client.py:304]
2026-06-08 17:41:18,708 DEBUG payload=[106, 38, 226, 158] [client.py:328]
2026-06-08 17:41:18,708 DEBUG sending message [client.py:341]
2026-06-08 17:41:18,809 DEBUG read=“” [client.py:398]
2026-06-08 17:41:18,809 DEBUG outstring=“bytearray(b’')” [client.py:400]
2026-06-08 17:41:18,817 ERROR failed to connect [client.py:279]
Traceback (most recent call last):
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/onlykey/client.py”, line 270, in _connect
self._hid.open_path(self.path)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File “hid.pyx”, line 158, in hid.device.open_path
OSError: open failed
2026-06-08 17:41:18,820 DEBUG connect failed, trying again in 1 second… [client.py:250]
2026-06-08 17:41:20,327 ERROR failed to connect [client.py:279]
Traceback (most recent call last):
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/onlykey/client.py”, line 270, in _connect
self._hid.open_path(self.path)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File “hid.pyx”, line 158, in hid.device.open_path
OSError: open failed
2026-06-08 17:41:20,328 DEBUG connect failed, trying again in 1 second… [client.py:250]
2026-06-08 17:41:21,837 ERROR failed to connect [client.py:279]
Traceback (most recent call last):
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/onlykey/client.py”, line 270, in _connect
self._hid.open_path(self.path)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File “hid.pyx”, line 158, in hid.device.open_path
OSError: open failed
2026-06-08 17:41:21,838 DEBUG connect failed, trying again in 1 second… [client.py:250]
2026-06-08 17:41:23,345 ERROR failed to connect [client.py:279]
Traceback (most recent call last):
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/onlykey/client.py”, line 270, in _connect
self._hid.open_path(self.path)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File “hid.pyx”, line 158, in hid.device.open_path
OSError: open failed
2026-06-08 17:41:23,346 DEBUG connect failed, trying again in 1 second… [client.py:250]
2026-06-08 17:41:24,853 ERROR failed to connect [client.py:279]
Traceback (most recent call last):
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/onlykey/client.py”, line 270, in _connect
self._hid.open_path(self.path)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File “hid.pyx”, line 158, in hid.device.open_path
OSError: open failed
2026-06-08 17:41:24,854 DEBUG connect failed, trying again in 1 second… [client.py:250]
2026-06-08 17:41:26,354 ERROR handler failed: {} not connected: “{}” [init.py:318]
Traceback (most recent call last):
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/onlykey/client.py”, line 270, in _connect
self._hid.open_path(self.path)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
File “hid.pyx”, line 158, in hid.device.open_path
OSError: open failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/device/onlykey.py”, line 44, in connect
self.ok = self._defs.OnlyKey()
~~~~~~~~~~~~~~~~~~^^
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/onlykey/client.py”, line 254, in init
raise e
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/onlykey/client.py”, line 245, in init
self._connect()
~~~~~~~~~~~~~^^
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/onlykey/client.py”, line 280, in _connect
raise OnlyKeyUnavailableException()
onlykey.client.OnlyKeyUnavailableException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/gpg/init.py”, line 310, in run_agent_internal
handler.handle(conn)
~~~~~~~~~~~~~~^^^^^^
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/gpg/agent.py”, line 308, in handle
handler(conn, args)
~~~~~~~^^^^^^^^^^^^
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/gpg/agent.py”, line 125, in
b’HAVEKEY’: lambda conn, args: self.have_key(conn, *args),
~~~~~~~~~~~~~^^^^^^^^^^^^^
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/gpg/agent.py”, line 271, in have_key
self.get_identity(keygrip=keygrip)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/util.py”, line 230, in wrapper
result = method(self, *args, **kwargs)
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/gpg/agent.py”, line 197, in get_identity
verifying_key = self.client.pubkey(identity=identity, ecdh=ecdh)
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/gpg/client.py”, line 28, in pubkey
with self.device:
^^^^^^^^^^^
File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/device/interface.py”, line 126, in enter
self.conn = self.connect()
~~~~~~~~~~~~^^

File “/home/onlykey_tester/.local/share/pipx/venvs/onlykey-agent/lib/python3.13/site-packages/libagent/device/onlykey.py”, line 52, in connect
raise interface.NotFoundError(‘{} not connected: “{}”’)
libagent.device.interface.NotFoundError: {} not connected: “{}”
2026-06-08 17:41:26,364 DEBUG waiting for connection on /home/onlykey_tester/.gnupg/onlykey/S.gpg-agent [agent.py:14]
```

Thanks for reporting this, yes we will want to look for a fix for the 30 key limit and the other issue mentioned. I need to find out if this is a limit that GPG has or if it is something we can change.

This is not a default GPG limit I have this limitation with the onlykey-gpg-agent not with the standard gpg-agent.

And I have done some more checks it is not specific to the last key I have entered.
The problem append on the last key what ever the order of the key importation.
but I can not say if the limit is on the number of keys or if it depend of the total size of the keys.