Skip to content

Two builds of the same app give different server output #4972

Closed

Description

@onmax

nitro build doesn't give the same output twice. I built the same app 3 times on main and got 3 different .output/server folders. The app has 150 files in public/. I ignored file mtimes when I compared the folders.

To reproduce, add 150 files to public/, run nitro build 3 times, and compare .output/server after each build. Nitro main at 3f1c8af, Node 24.21.0, Linux.

The cause is in #nitro/virtual/public-assets-data. Nitro reads the public files 25 at a time, and it adds each file to the list when its read finishes. The reads finish in a different order on each build. So the list order changes, and the server chunk changes with it.

Sorting the list by path fixes it. With the sort, 3 builds gave the same output, and every route still returns the same response.

I have the fix and a test on a branch. The test fails on main.
main...onmax:nitro:fix/public-assets-manifest-order

I can open a PR if you want it.

Activity

  1. added
    discussion
    bug
    and removed
    discussion
    on Oct 30, 2026
  2. pi0 commented on Oct 30, 2026

    @pi0
    Member

    PR welcome!

  3. added theissue type on Nov 10, 2026
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

    bug

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions