socketio/socket.io · error · Error
No adapter for this namespace, are you trying to get the lis
Error message
No adapter for this namespace, are you trying to get the list of clients of a dynamic namespace?
What it means
Thrown by the deprecated BroadcastOperator.allSockets() when this.adapter is undefined (the BroadcastOperator was constructed without an adapter). allSockets() delegates to the namespace adapter; without one it cannot enumerate sockets. The message specifically flags dynamic namespaces, which do not have a concrete adapter instance to query.
Source
Thrown at packages/socket.io/lib/broadcast-operator.ts:349
err.responses = responses;
return reject(err);
} else {
return resolve(responses);
}
});
this.emit(ev, ...(args as any[] as EventParams<EmitEvents, Ev>));
});
}
/**
* Gets a list of clients.
*
* @deprecated this method will be removed in the next major release, please use {@link Server#serverSideEmit} or
* {@link fetchSockets} instead.
*/
public allSockets(): Promise<Set<SocketId>> {
if (!this.adapter) {
throw new Error(
"No adapter for this namespace, are you trying to get the list of clients of a dynamic namespace?",
);
}
return this.adapter.sockets(this.rooms);
}
/**
* Returns the matching socket instances. This method works across a cluster of several Socket.IO servers.
*
* Note: this method also works within a cluster of multiple Socket.IO servers, with a compatible {@link Adapter}.
*
* @example
* // return all Socket instances
* const sockets = await io.fetchSockets();
*
* // return all Socket instances in the "room1" room
* const sockets = await io.in("room1").fetchSockets();
*View on GitHub (pinned to ae7fb46e08)
Solutions
- Use a concrete namespace (io.of('/name')) instead of a dynamic regex namespace when you need to list sockets.
- Migrate from the deprecated allSockets() to fetchSockets() on a concrete namespace.
- For dynamic namespaces, iterate matched namespaces via io.of(/^/.../).sockets or resolve a specific namespace instance first.
Example fix
// before
const ids = await io.of(/^/tenant-/).allSockets(); // throws
// after
const ids = await io.of('/tenant-1').allSockets(); // concrete namespace
// or, the non-deprecated alternative:
const sockets = await io.of('/tenant-1').fetchSockets(); Defensive patterns
Strategy: validation
Validate before calling
function hasAdapter(operator){ return !!operator.adapter; } Type guard
function isConcreteNamespace(ns){ return !!ns && !!ns.adapter; } Prevention
- Avoid calling the deprecated allSockets() on dynamic (regex) namespaces.
- Prefer fetchSockets() on a concrete namespace.
- Resolve a specific namespace instance before listing clients.
When it happens
Trigger: Calling allSockets() on a BroadcastOperator that has no adapter — typically obtained from a dynamic/regex namespace (io.of(/^/dynamic-/)) whose matching Namespace is abstract, or by constructing a BroadcastOperator directly without injecting an adapter.
Common situations: Using io.of(/regex/).allSockets() on a dynamic namespace; or calling the deprecated allSockets() (the message itself notes deprecation) instead of fetchSockets/allSockets on a concrete namespace.
Related errors
- "${String(ev)}" is a reserved event name
- "${String(ev)}" is a reserved event name
- You are trying to attach socket.io to an express request han
AI-assisted analysis of socketio/socket.io@ae7fb46e08 (2026-08-03).
Data as JSON: /data/errors/7bfd7fa3a7a3a073.json.
Report an issue: GitHub.