nestjs/nest · error
useWebSocketAdapter() was called after WebSocket gateways we
Error message
useWebSocketAdapter() was called after WebSocket gateways were already initialized. The provided adapter will be stored but will NOT be applied to existing gateways — they remain bound to the previously installed adapter. To install a custom adapter, call app.useWebSocketAdapter(...) BEFORE app.init() (or app.listen()).
What it means
Error "useWebSocketAdapter() was called after WebSocket gateways were already initialized. The provided adapter will be stored but will NOT be applied to existing gateways — they remain bound to the previously installed adapter. To install a custom adapter, call app.useWebSocketAdapter(...) BEFORE app.init() (or app.listen())." thrown in nestjs/nest.
Source
Thrown at packages/core/nest-application.ts:486
}
public setGlobalPrefix(prefix: string, options?: GlobalPrefixOptions): this {
this.config.setGlobalPrefix(prefix);
if (options) {
const exclude = options?.exclude
? mapToExcludeRoute(options.exclude)
: [];
this.config.setGlobalPrefixOptions({
...options,
exclude,
});
}
return this;
}
public useWebSocketAdapter(adapter: WebSocketAdapter): this {
if (this.isWsModuleRegistered) {
this.logger.warn(
'useWebSocketAdapter() was called after WebSocket gateways were already initialized. The provided adapter will be stored but will NOT be applied to existing gateways — they remain bound to the previously installed adapter. To install a custom adapter, call app.useWebSocketAdapter(...) BEFORE app.init() (or app.listen()).',
);
}
this.config.setIoAdapter(adapter);
return this;
}
public useGlobalFilters(...filters: ExceptionFilter[]): this {
filters = this.applyInstanceDecoratorIfRegistered<ExceptionFilter>(
...filters,
);
this.config.useGlobalFilters(...filters);
filters.forEach(item =>
this.graphInspector.insertOrphanedEnhancer({
subtype: 'filter',
ref: item,
}),
);View on GitHub (pinned to 3f8a0ce183)
When it happens
Trigger: Thrown at packages/core/nest-application.ts:485 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of nestjs/nest@3f8a0ce183 (2026-08-21).
Data as JSON: /api/errors/846206d42c6fc670.
Report an issue: GitHub.