vercel/next.js · error
The static directory has been deprecated in favor of the pub
Error message
The static directory has been deprecated in favor of the public directory. https://nextjs.org/docs/messages/static-dir-deprecated
What it means
Deprecation warning from the dev server's route-filesystem scanning: while collecting files it successfully read the legacy top-level static/ directory (legacyStaticFolderPath) alongside public/. The static directory was replaced by public long ago; serving still works but the folder is unsupported and the warning points at the migration docs.
Source
Thrown at packages/next/src/server/lib/router-utils/filesystem.ts:325
}
try {
for (const file of await recursiveReadDir(publicFolderPath)) {
// Ensure filename is encoded and normalized.
publicFolderItems.add(encodeURIPath(normalizePathSep(file)))
}
} catch (err: any) {
if (err.code !== 'ENOENT') {
throw err
}
}
try {
for (const file of await recursiveReadDir(legacyStaticFolderPath)) {
// Ensure filename is encoded and normalized.
legacyStaticFolderItems.add(encodeURIPath(normalizePathSep(file)))
}
Log.warn(
`The static directory has been deprecated in favor of the public directory. https://nextjs.org/docs/messages/static-dir-deprecated`
)
} catch (err: any) {
if (err.code !== 'ENOENT') {
throw err
}
}
try {
for (const file of await recursiveReadDir(nextStaticFolderPath)) {
// Ensure filename is encoded and normalized.
nextStaticFolderItems.add(
path.posix.join(
'/_next/static',
encodeURIPath(normalizePathSep(file))
)
)
}View on GitHub (pinned to 43273a1d21)
Solutions
- Move files from the static/ directory to the public/ directory.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/next/src/server/lib/router-utils/filesystem.ts:325 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vercel/next.js@43273a1d21 (2026-08-19).
Data as JSON: /api/errors/26b9efb50144e5e5.
Report an issue: GitHub.