Skip to content

Fix “unknown peripheral null connected!” warning#62

Closed
dnicolson wants to merge 1 commit into
stoprocent:mainfrom
dnicolson:fix-unknown-peripheral-warning
Closed

Fix “unknown peripheral null connected!” warning#62
dnicolson wants to merge 1 commit into
stoprocent:mainfrom
dnicolson:fix-unknown-peripheral-warning

Conversation

@dnicolson
Copy link
Copy Markdown

This fixes a race condition when cancelConnect() is called immediately, and the connection queue can be emptied before the controller completes with an error. Previously, this caused uuid to be null in the connect event, triggering the "unknown peripheral null connected!" warning.

This code can reproduce the warning:

const noble = require('@stoprocent/noble');

const MAC = '112233445566';

async function main() {
  await noble.waitForPoweredOnAsync();
  setTimeout(() => noble.cancelConnect(MAC), 10);
  await noble.connectAsync(MAC).catch(() => {});
}

main();

@stoprocent stoprocent closed this Mar 30, 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.

2 participants