Skip to content

chore(autonat-v2): Fix Spurious Exceptions#3400

Open
ruediste wants to merge 1 commit intolibp2p:mainfrom
ruediste:fix-exceptions
Open

chore(autonat-v2): Fix Spurious Exceptions#3400
ruediste wants to merge 1 commit intolibp2p:mainfrom
ruediste:fix-exceptions

Conversation

@ruediste
Copy link
Copy Markdown
Contributor

@ruediste ruediste commented Mar 8, 2026

Description

When running autonat-v2, exceptions such as the following are printed on the console:

2026-03-07T15:49:04.263Z libp2p:auto-nat-v2:client:error could not verify addresses - InvalidParametersError: Multiaddr / was not an IPv4, IPv6, DNS, DNS4, DNS6 or DNSADDR address
    at getNetConfig (file:///home/ruedi/git/js-libp2p/packages/utils/dist/src/multiaddr/get-net-config.js:47:19)
    at file:///home/ruedi/git/js-libp2p/packages/protocol-autonat-v2/dist/src/client.js:291:20
    at Array.some (<anonymous>)
    at AutoNATv2Client.verifyExternalAddresses (file:///home/ruedi/git/js-libp2p/packages/protocol-autonat-v2/dist/src/client.js:290:45);

They come from getNetConfig(), which throws an exception when an address isn't a ip4 or ip6 addr. Those exceptions are quite confusing to a newcomer and should not be logged, as it can be expected that other types of addresses are processed.

Notes & open questions

The choice to throw exceptions instead of returning a value for getNetConfig() seems quite debatable to me...

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

@ruediste ruediste requested a review from a team as a code owner March 8, 2026 12:47
@ruediste ruediste changed the title chore(autonat-v2) Fix Spurious Exceptions chore(autonat-v2): Fix Spurious Exceptions Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant