{"record":{"id":"0089c6ae6cde98e9","repo":"withastro/astro","slug":"unknownfilesystemerror-0089c6","errorCode":"UnknownFilesystemError","errorMessage":"An unknown error occurred while reading or writing files to disk.","messagePattern":"An unknown error occurred while reading or writing files to disk\\.","errorType":"exception","errorClass":"AstroError","httpStatus":null,"severity":"error","filePath":"packages/astro/src/assets/fonts/vite-plugin-fonts.ts","lineNumber":369,"sourceCode":"\t\t\t},\n\t\t},\n\t\tasync buildEnd() {\n\t\t\t// Run once during the build, no matter how many environments there are\n\t\t\tif (built) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (sync || !settings.config.fonts?.length || this.environment.config.command === 'serve') {\n\t\t\t\tcleanup();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst dir = getClientOutputDirectory(settings);\n\t\t\t\tconst fontsDir = new URL(`.${assetsDir}`, dir);\n\t\t\t\ttry {\n\t\t\t\t\tmkdirSync(fontsDir, { recursive: true });\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tthrow new AstroError(AstroErrorData.UnknownFilesystemError, { cause });\n\t\t\t\t}\n\t\t\t\tif (fontFileById) {\n\t\t\t\t\tlogger.info(\n\t\t\t\t\t\t'assets',\n\t\t\t\t\t\t`Copying fonts (${fontFileById.size} file${fontFileById.size === 1 ? '' : 's'})...`,\n\t\t\t\t\t);\n\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\tArray.from(fontFileById.entries()).map(async ([id, associatedData]) => {\n\t\t\t\t\t\t\tconst data = await fontFetcher!.fetch({ id, ...associatedData });\n\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\twriteFileSync(new URL(id, fontsDir), data);\n\t\t\t\t\t\t\t} catch (cause) {\n\t\t\t\t\t\t\t\tthrow new AstroError(AstroErrorData.UnknownFilesystemError, { cause });\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t} finally {","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/withastro/astro/blob/d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca/packages/astro/src/assets/fonts/vite-plugin-fonts.ts#L351-L387","documentation":"Thrown during the fonts Vite plugin build close hook when creating the client output directory for fonts fails. After confirming a non-serve build, it computes the assets dir and calls mkdirSync(fontsDir, { recursive: true }); any error from that mkdir is wrapped as UnknownFilesystemError with the original cause.","triggerScenarios":"Triggered when writeBundle/closeBundle runs during `astro build`, settings.config.fonts has entries, the command is not 'serve', and mkdirSync fails on the client output fonts directory. Failures include ENOSPC, EACCES, EROFS (read-only filesystem), or a parent path that cannot be created.","commonSituations":"Building into a read-only output directory (container/CI), out of disk space, insufficient permissions on the dist folder, antivirus/lock on Windows, or a misconfigured outDir/assetsDir pointing at an invalid location.","solutions":["Confirm the build output directory is writable and not on a read-only filesystem.","Free disk space or raise the storage quota if ENOSPC.","Check permissions on the configured outDir (and assetsDir) — the build user needs write+create access.","If in a container, ensure the mounted volume is writable.","Inspect the `cause` for the precise errno and path."],"exampleFix":"// before - outDir on a read-only mount\nbuild: { assetsDir: '/readonly/assets' }\n\n// after\nbuild: { assetsDir: 'dist/assets' }","handlingStrategy":"validation","validationCode":"import { accessSync, constants } from 'node:fs';\nimport { dirname } from 'node:path';\nfunction isDirWritable(p: string): boolean {\n  try { accessSync(dirname(p), constants.W_OK); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build into a writable directory; avoid read-only mounts.","Ensure adequate free disk space before building.","Run the build as a user with write access to the output dir."],"tags":["fonts","filesystem","build","permissions"],"backgroundTag":null,"analyzedSha":"d081033d5fe8e8a68c4bbbad4af9d2deb9c74bca","analyzedAt":"2026-08-12T13:37:29.035Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}