vercel/next.js · error · Error

Method not implemented

Error message

Method not implemented

What it means

Explicit stub on an IncomingMessage/ServerResponse mock: the trailers getter (and siblings like aborted, complete) is deliberately unimplemented because the Next.js codebase never reads it through MockedRequest/MockedResponse. Hitting it means test or tooling code relied on a mock API surface that was intentionally left out.

Source

Thrown at packages/next/src/server/lib/mock-request.ts:120

   * @deprecated — since v13.0.0 - Use socket instead.
   */
  public get connection(): Socket {
    return this.socket
  }

  // The following methods are not implemented as they are not used in the
  // Next.js codebase.

  public get aborted(): boolean {
    throw new Error('Method not implemented')
  }

  public get complete(): boolean {
    throw new Error('Method not implemented')
  }

  public get trailers(): NodeJS.Dict<string> {
    throw new Error('Method not implemented')
  }

  public get trailersDistinct(): NodeJS.Dict<string[]> {
    throw new Error('Method not implemented')
  }

  public get rawTrailers(): string[] {
    throw new Error('Method not implemented')
  }

  public get rawHeaders(): string[] {
    throw new Error('Method not implemented.')
  }

  public setTimeout(): this {
    throw new Error('Method not implemented.')
  }
}

View on GitHub (pinned to 0eb3775416)

Solutions

  1. Internal mock request limitation; avoid using that method in this code path or upgrade Next.js.
Defensive patterns

Strategy: validation

When it happens

Trigger: An unimplemented method on the mock request object is called.

Common situations: Code exercising a Node request API that the mock request in preview/edge mode does not implement.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/178a8ef42b5e5f22. Report an issue: GitHub.