Skip to content

Content-Length mismatch on builds/meta: app manifest rewritten after Nitro indexes public assets (Vite env API) #36688

Closed as not planned

Description

@itsmnthn

Environment

Operating system macOS 27.2.0
CPU Apple M1 Pro (8 cores)
Node.js version v26.12.1
nuxt/cli version 4.0.1-2610211147-97b4830
Package manager [email protected]
Nuxt version 5.0.0-2610211357-d296167
Nitro version 3.0.260903-beta
Builder [email protected]
Config $development, $production, aiReady, alias, colorMode, compatibilityDate, css, experimental, features, fonts, future, icon, modules, ogImage, prerender, robots, routeRules, runtimeConfig, schemaOrg, site, sitemap, typescript, vite
Modules @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxt/[email protected], @nuxtjs/[email protected], @nuxt/[email protected], @pinia/[email protected], @vueuse/[email protected]

Reproduction

  1. Nuxt 5 nightly with @nuxtjs/seo and some prerendered routes, then nuxt build.
  2. node .output/server/index.mjs
  3. curl -sD - -o meta.json http://localhost:3000/_nuxt/builds/meta/<id>.json: the content-length header is bigger than wc -c meta.json.

Describe the bug

Nitro Vite environment API enabled

Problem

With the Vite environment API, writeAppManifest("public") in @nuxt/nitro-server runs on both compiled and prerender:done. The prerender:done write happens after Nitro has generated its public asset manifest (sizes and etags). Any change another module makes to builds/meta/<id>.json or builds/latest.json in between is erased, but Nitro keeps the old size.

Example with nuxt-skew-protection (via @nuxtjs/seo), which adds a skewProtection field in nitro:build:public-assets:

File Served content-length Actual body
_nuxt/builds/meta/<id>.json 7301 7243
_nuxt/builds/latest.json 903 71

The file on disk is about 2 seconds newer than the mtime in the server's asset manifest.

Impact

The browser fails the request with net::ERR_CONTENT_LENGTH_MISMATCH, and Nuxt logs [NUXT_E5002]. _isPrerenderedInManifest() then returns false, so client navigation to routes prerendered only by crawling or nitro.prerender.routes skips _payload.json and renders empty. A full reload works.

Expected
Nuxt shouldn't rewrite public files after Nitro has indexed them. It could write the final manifest before the public asset manifest is generated, or skip the second write when nothing has changed.

Additional context

No response

Logs

Activity

  1. added
    nitro
    on Oct 23, 2026
  2. added theissue type on Oct 23, 2026
  3. danielroe commented on Oct 25, 2026

    @danielroe
    Member

    this is a regression in srvx - I opened h3js/srvx#337 to solve, but it's also solved in #36671.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    5.xnitropending triage

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions