{"record":{"id":"26b9efb50144e5e5","repo":"vercel/next.js","slug":"the-static-directory-has-been-deprecated-in-favor","errorCode":null,"errorMessage":"The static directory has been deprecated in favor of the public directory. https://nextjs.org/docs/messages/static-dir-deprecated","messagePattern":"The static directory has been deprecated in favor of the public directory\\. https://nextjs\\.org/docs/messages/static-dir-deprecated","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/next/src/server/lib/router-utils/filesystem.ts","lineNumber":325,"sourceCode":"    }\n\n    try {\n      for (const file of await recursiveReadDir(publicFolderPath)) {\n        // Ensure filename is encoded and normalized.\n        publicFolderItems.add(encodeURIPath(normalizePathSep(file)))\n      }\n    } catch (err: any) {\n      if (err.code !== 'ENOENT') {\n        throw err\n      }\n    }\n\n    try {\n      for (const file of await recursiveReadDir(legacyStaticFolderPath)) {\n        // Ensure filename is encoded and normalized.\n        legacyStaticFolderItems.add(encodeURIPath(normalizePathSep(file)))\n      }\n      Log.warn(\n        `The static directory has been deprecated in favor of the public directory. https://nextjs.org/docs/messages/static-dir-deprecated`\n      )\n    } catch (err: any) {\n      if (err.code !== 'ENOENT') {\n        throw err\n      }\n    }\n\n    try {\n      for (const file of await recursiveReadDir(nextStaticFolderPath)) {\n        // Ensure filename is encoded and normalized.\n        nextStaticFolderItems.add(\n          path.posix.join(\n            '/_next/static',\n            encodeURIPath(normalizePathSep(file))\n          )\n        )\n      }","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/vercel/next.js/blob/43273a1d21a35646ec43230e05727e18ac258396/packages/next/src/server/lib/router-utils/filesystem.ts#L307-L343","documentation":"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.","triggerScenarios":"Thrown at packages/next/src/server/lib/router-utils/filesystem.ts:325 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Move files from the static/ directory to the public/ directory."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"43273a1d21a35646ec43230e05727e18ac258396","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}