Skip to content

Troubleshooting

TonyD365-Agent edited this page Nov 21, 2026 · 3 revisions

Troubleshooting

EnvelopeError reasons

Reason Usually means What to do
envelope too large Message over max_size (1 MiB) Send smaller bodies, or raise Opener(max_size=...) on the receiver
malformed envelope / unsupported envelope Not a lanpair v2 envelope: garbage, truncated data, an old version Check your transport delivers whole messages (UDP size limits, TCP framing)
unknown sender The sender is not paired with this receiver opener.add_peer(their_public_identity)
bad signature The message was changed, or add_peer got the wrong public identity Re-pair; check nothing rewrites the bytes
not addressed to this device Sealed for another device's public identity The sender must seal for this device's PublicIdentity
stale or future timestamp Clocks differ by more than 30 s, or the message is old Turn on network time (NTP) on both devices
sent before this receiver started MemorySeqStore refuses messages stamped earlier than 30 s after start Expected right after a restart; use JsonFileSeqStore to avoid it
replayed message Same or older sequence number than one already accepted Expected for duplicates; if every message fails, the sender's clock jumped back a lot
cannot decrypt Encrypted for a different X25519 key Re-pair with the full 64-byte to_bytes() identity

Catch EnvelopeError, log the reason, and keep going: a bad packet should never stop your receive loop.

Discovery finds nothing

  • Firewall: mDNS is UDP port 5353 multicast to 224.0.0.251. Allow it (macOS asks the first time; Windows Defender Firewall needs a rule for Python on private networks).
  • Different networks: guest Wi-Fi, VLANs and "client isolation" on access points block multicast between devices. Both must be on the same segment.
  • VPN: many VPN clients route or block multicast; try with the VPN off.
  • Docker: containers on the default bridge network don't see the host's multicast; use --network host.
  • Different app names: Announcer(..., app="x") is only found by find(..., app="x").
  • Too short: raise seconds in browse / find on slow networks (3–5 s).

Key store

  • KeyStoreError: ... needs the keyring package: pip install "lanpair[keyring]".
  • Headless Linux (servers, Raspberry Pi without a desktop): there is no Secret Service. Install and unlock gnome-keyring, or, if the disk is trusted, use the keyrings.alt file backend: pip install keyrings.alt and set PYTHON_KEYRING_BACKEND=keyrings.alt.file.PlaintextKeyring.
  • macOS asks for permission the first time Python reads the Keychain item: choose Always Allow.

Pairing

Error What to do
this pairing offer has expired Make a new offer (host.pairing_offer()); default lifetime 5 minutes
the host did not confirm the pairing The device can't reach the address in the code: same network? Firewall allows the host's UDP port (fix it with Host(port=...))? Is the host running?
offer refused as used or locked (host side) Each offer pairs one device and locks after 5 wrong answers: make a new one
this offer is for app 'x' Host and device must use the same app=
call start() before pair() Start the device first, or use with Device(...) as dev:

Messages don't arrive

  • node.dropped counts refused datagrams; if it grows, see the EnvelopeError reasons above.
  • Firewalls: allow the node's port for UDP and, from 1.2, TCP (the same number; it is saved in node.json; pass port= to fix it).
  • Bodies over 1 MiB raise ValueError. Up to 1.1, the limit was about 6 KB; upgrade to 1.2 for larger ones. UDP may lose small messages, so retry what matters; a large message that can't be delivered raises OSError.

Clone this wiki locally