Symptom
next analyze export --snapshot before exits with code 1: Error: ENOENT: no such file or directory, open '.next/diagnostics/analyze/history/snapshot-before/icon/[__metadata_id__]/analyze.data'.
Evidence what you'll see
next analyze --output --snapshot beforecompletes. The writer storedsnapshot-before/icon/analyze.data. No[__metadata_id__]directory exists.- The app is a root layout, one page, and
app/icon.tsxthat exportsgenerateImageMetadata()returning two ids (32and192). - Replacing that icon with a single-size icon (
sizeandcontentType, nogenerateImageMetadata) makes the same two commands succeed.
Why it happens
Two route indexes disagreed. Turbopack writes analyze.data under the structural key /icon and lists it in route-summaries.json. routes.json was built from the routes manifest, which uses /icon/[__metadata_id__]. Readers turned each listed route into <route>/analyze.data and asked for a file that was never written. Pull request 100081 uses route-summaries.json as the only route index.
Affected versions
An App Router app whose app/icon.tsx uses generateImageMetadata. The linked issue's reproduction repository is https://github.com/Wizzlesky124/next-analyze-export-icon-repro. The linked issue does not name a Next.js version in the report body.
Fix steps
0 of 2 done
Your check marks stay in this browser only.
How to check it worked
next analyze export --snapshot beforefinishes withoutENOENTonicon/[__metadata_id__]/analyze.datawhenapp/icon.tsxexportsgenerateImageMetadata.
If it still fails
- No published non-prerelease tag contains pull request 100081. Tag
v16.4.2was compared against mergea8b3bf15d569and does not contain it. - The same index mismatch also affected
generateSitemapsroutes in the pull request description.
Sources and credit
Summarized in our own words from these public reports. Credit goes to their authors.
Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change
Hit an error we don't cover? Submit it