#5202·scapy

netbios: `nbns_resolve` with a list of names now raises `TypeError: unhashable type: 'list'` (since #5115)

Author: IcantFind-a-usernameCreated Sep 26, 2026Updated Sep 27, 2026
Labelsbug

Brief description

Since #5115 ("netbios: key the NBNS resolver cache by name"), calling nbns_resolve with a list of names fails in the cache lookup, because the list is used inside the cache key (qname, raw). Before #5115 the same call did not fail there: it went on to build the request from the list and pass it to sr1.

The type hint says qname: str, so a list may simply not be supported; if so, please close this. Reporting it because the behavior changed with the cache change, and scapy fields otherwise accept lists (one packet per value).

Scapy version

master at c5e9a5b0 (2026-09-26)

Python version

3.10

Operating system

Linux (Docker)

Additional environment information

No response

How to reproduce

python
from unittest import mock
from scapy.layers.netbios import nbns_resolve

with mock.patch("scapy.layers.netbios.conf.route.get_if_bcast", return_value=["192.0.2.255"]):
    nbns_resolve(["ALPHA", "BETA"], iface="test")

Actual result

  File ".../scapy/config.py", line 395, in __contains__
    if not super(CacheInstance, self).__contains__(item):
TypeError: unhashable type: 'list'

Expected result

Either the pre-#5115 behavior, or a clear error saying that only a single name is accepted. (An empty list now fails the same way in the cache lookup; before #5115 it failed later, while sending.)

Related resources

#5115 (cc @KernelClint). Found by differential testing of recent pull requests and reproduced by hand on current master.