nestjs/nest · error

Warning! "${moduleRef.name}" module exposes a "configure" me

Error message

Warning! "${moduleRef.name}" module exposes a "configure" method that throws an exception in the preview mode (possibly due to missing dependencies). Note: you can ignore this message, just be aware that some of those conditional middlewares will not be reflected in your graph.

What it means

Error "Warning! "${moduleRef.name}" module exposes a "configure" method that throws an exception in the preview mode (possibly due to missing dependencies). Note: you can ignore this message, just be aware that some of those conditional middlewares will not be reflected in your graph." thrown in nestjs/nest.

Source

Thrown at packages/core/middleware/middleware-module.ts:119

    const { instance } = moduleRef;
    if (!instance.configure) {
      return;
    }
    const middlewareBuilder = new MiddlewareBuilder(
      this.routesMapper,
      this.httpAdapter,
      this.routeInfoPathExtractor,
    );
    try {
      await instance.configure(middlewareBuilder);
    } catch (err) {
      if (!this.appOptions.preview) {
        throw err;
      }
      const warningMessage =
        `Warning! "${moduleRef.name}" module exposes a "configure" method that throws an exception in the preview mode` +
        ` (possibly due to missing dependencies). Note: you can ignore this message, just be aware that some of those conditional middlewares will not be reflected in your graph.`;
      this.logger.warn(warningMessage);
    }

    if (!(middlewareBuilder instanceof MiddlewareBuilder)) {
      return;
    }
    const config = middlewareBuilder.build();
    middlewareContainer.insertConfig(config, moduleKey);
  }

  public async registerMiddleware(
    middlewareContainer: MiddlewareContainer,
    applicationRef: any,
  ) {
    const configs = middlewareContainer.getConfigurations();
    const registerAllConfigs = async (
      moduleKey: string,
      middlewareConfig: MiddlewareConfiguration[],
    ) => {

View on GitHub (pinned to dd75d7bd8c)

When it happens

Trigger: Thrown at packages/core/middleware/middleware-module.ts:119 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nestjs/nest@dd75d7bd8c (2026-08-21). Data as JSON: /api/errors/af01c1bfe00d4e16. Report an issue: GitHub.