next start assumes it is alone. Its state splits into two kinds.
Per-instance caches. All on Next.js 16.4.5, next build && next start:
- ISR and on-demand revalidation. Each instance regenerates its own copy, and
revalidatePath/revalidateTagmark entries stale only in the process that ran them (measured in the ISR question). use cachekeeps an in-memory LRU per process, anduse cache: remoteis the same LRU untilcacheHandlers.remoteis set (see that question).- The image optimizer. The same
/_next/imageURL wasMISSthenHITon instance A, thenMISSagain on B: each wrote its own file in.next/cache/images.
Per-build identity. Instances built separately differ even from the same commit:
- Server Action IDs and encryption key. A build generates an AES key (or reuses one cached in
.next/cache/.rscinfofor 14 days) and salts action IDs with it. Two fresh checkouts got different keys and different IDs, so an action posted to the other instance got409andFailed to find Server Action "0090f7…". This request might be from an older or newer deployment. - Build ID. It differs per build, so a client navigation answered by the other build turned into a full page reload.
The fixes the self-hosting guide lists:
- build once and run that output everywhere, or set the same
NEXT_SERVER_ACTIONS_ENCRYPTION_KEY(base64, 16, 24 or 32 bytes) at every build; - set
deploymentIdper deployment, so assets carry?dpl=and mismatches reload instead of mixing versions; - configure
cacheHandler(ISR, route handlers, and images withimages.customCacheHandler: true) andcacheHandlers(use cache) backed by a shared store with a tag index, andcacheMaxMemorySize: 0so no instance keeps a private copy. These handlers weren't built here.