vercel/next.js · error

Cannot render page with path "${pathname}", did you mean "/$

Error message

Cannot render page with path "${pathname}", did you mean "/${pathname}"?. See more info here: https://nextjs.org/docs/messages/render-no-starting-slash

What it means

Route-path warning in Server.renderImpl (base-server.ts): the pathname handed to the internal render API does not start with '/'. Internal rendering expects root-relative paths; a bare 'foo' silently fails route matching, so the dev-facing warning (console.warn, not a throw) suggests the leading-slash form '/foo' while rendering continues.

Source

Thrown at packages/next/src/server/base-server.ts:2250

    }

    return this.getInternalWaitUntil()
  }

  protected getInternalWaitUntil(): WaitUntil | undefined {
    return undefined
  }

  private async renderImpl(
    req: ServerRequest,
    res: ServerResponse,
    pathname: string,
    query: NextParsedUrlQuery = {},
    parsedUrl?: NextUrlWithParsedQuery,
    internalRender = false
  ): Promise<void> {
    if (!pathname.startsWith('/')) {
      console.warn(
        `Cannot render page with path "${pathname}", did you mean "/${pathname}"?. See more info here: https://nextjs.org/docs/messages/render-no-starting-slash`
      )
    }

    if (
      this.serverOptions.customServer &&
      pathname === '/index' &&
      !(await this.hasPage('/index'))
    ) {
      // maintain backwards compatibility for custom server
      // (see custom-server integration tests)
      pathname = '/'
    }

    const ua = req.headers['user-agent'] || ''
    this.renderOpts.botType = getBotType(ua)

    // we allow custom servers to call render for all URLs

View on GitHub (pinned to 258b1c1bc0)

Solutions

  1. Prefix the page path with a leading slash, e.g. render "/pathname" instead of "pathname".
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/next/src/server/base-server.ts:2243 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of vercel/next.js@258b1c1bc0 (2026-08-19). Data as JSON: /api/errors/cdab83d9d46010c5. Report an issue: GitHub.