Skip to content

Device open errors during initialization (system devices) #95

Open

Description

@goncalomb

Bug Description

On v3 a simple requestDevice with no filters throws device open errors, where on v2 it would not.

/tmp/usb-test/node_modules/usb/dist/index.js:241
            serialNumber: device.serialNumber || undefined
                                 ^

Error: open error: permission denied (errno 13)
    at WebUSB.requestDevice (/tmp/usb-test/node_modules/usb/dist/index.js:241:34)
    at async file:///tmp/usb-test/index.mjs:2:1 {
  code: 'GenericFailure'
}

It appears to be because on v2 initialization errors (e.g. system devices) were silently ignored:

https://github.com/node-usb/node-usb/blob/07eb8d98acd8ceb57dfd92ba5c08a27054a6201e/tsc/webusb/index.ts#L277-L279

Steps to Reproduce

mkdir /tmp/usb-test
cd /tmp/usb-test
cat <<EOF >index.mjs
import { webusb } from 'usb';
await webusb.requestDevice({ filters: [] });
EOF

npm i usb@2
node index.mjs # ok, no output

npm i usb@3
node index.mjs # "open error: permission denied"
sudo node index.mjs # ok, no output (can open system devices)

Additional Information

  • Operating System: Linux Mint 22.3
  • Runtime (node -v or electron -v): v26.7.0
  • Node USB Version (npm ls usb): usb@3.2.1

Activity

  1. thegecko commented on Oct 18, 2026

    @thegecko
    Member

    Thanks for raising this issue @goncalomb

    I've created an initial fix in #96

    Please confirm if this fixes your issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions