{"record":{"id":"b98ff47aaba1cc1a","repo":"quarkusio/quarkus","slug":"failed-to-write-windows-configfile-toabsolutepat","errorCode":null,"errorMessage":"Failed to write Windows ${configFile.toAbsolutePath()}","messagePattern":"Failed to write Windows (.+?)","errorType":"exception","errorClass":"UncheckedIOException","httpStatus":null,"severity":"critical","filePath":"extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java","lineNumber":146,"sourceCode":"                        // Windows is case insensitive, doesn't matter.\n                        \"filename.Arial=ARIAL.TTF\\n\" +\n                        \"filename.Arial_Bold=ARIALBD.TTF\\n\" +\n                        \"filename.Arial_Italic=ARIALI.TTF\\n\" +\n                        \"filename.Arial_Bold_Italic=ARIALBI.TTF\\n\" +\n                        \"filename.Courier_New=COUR.TTF\\n\" +\n                        \"filename.Courier_New_Bold=COURBD.TTF\\n\" +\n                        \"filename.Courier_New_Italic=COURI.TTF\\n\" +\n                        \"filename.Courier_New_Bold_Italic=COURBI.TTF\\n\" +\n                        \"filename.Times_New_Roman=TIMES.TTF\\n\" +\n                        \"filename.Times_New_Roman_Bold=TIMESBD.TTF\\n\" +\n                        \"filename.Times_New_Roman_Italic=TIMESI.TTF\\n\" +\n                        \"filename.Times_New_Roman_Bold_Italic=TIMESBI.TTF\\n\" +\n                        \"filename.Symbol=SYMBOL.TTF\\n\" +\n                        \"filename.Wingdings=WINGDING.TTF\\n\";\n                Files.writeString(configFile, minimalConfig, StandardCharsets.UTF_8);\n            }\n        } catch (IOException e) {\n            throw new UncheckedIOException(\"Failed to write Windows \" + configFile.toAbsolutePath(), e);\n        }\n    }\n}\n\n/**\n * Cut the dependency on Swing and Printing - we support server side, headless mode.\n * TODO: If an extension in Quarkiverse complains, we revisit it here.\n */\n@TargetClass(className = \"sun.awt.windows.WToolkit\", onlyWith = IsWindows.class)\nfinal class Target_sun_awt_windows_WToolkit {\n\n    @Substitute\n    public PrintJob getPrintJob(Frame frame, String jobtitle, Properties props) {\n        throw new UnsupportedOperationException(\"Printing is not supported with Quarkus AWT extension.\");\n    }\n\n    @Substitute\n    public PrintJob getPrintJob(Frame frame, String jobtitle, JobAttributes jobAttributes, PageAttributes pageAttributes) {","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/awt/runtime/src/main/java/io/quarkus/awt/runtime/JDKSubstitutions.java#L128-L164","documentation":"When running Windows-native AWT headless in a container/native-image, the Quarkus AWT extension generates a minimal Windows font configuration file pointing at system font files (e.g. ARIAL.TTF, TIMESBI.TTF). If writing that file fails with an IOException, the code wraps it in an UncheckedIOException with this message. It means the fontconfig bootstrap for the JDK could not be created, so headless graphics/font rendering cannot proceed.","triggerScenarios":"Calling any AWT/font-metric API (e.g. FontMetrics, BufferedImage drawing, PDF image generation with fonts) on a Windows target where JDKSubstitutions.setOsNameAndVersion runs and Files.writeString of the temporary fontconfig file throws IOException — typically due to a read-only filesystem, missing temp directory, or disk full.","commonSituations":"Windows containers with read-only C: drive or restricted temp dirs; native-image Windows builds where the working/temp path is not writable; disk-quota exhaustion; antivirus blocking file creation.","solutions":["Verify the temp/working directory used for the generated fontconfig file is writable by the process user","Check disk space and permissions on the target path shown in the error message","Ensure no security policy or antivirus blocks java.nio.file.Files.writeString in that directory","Pin to a JDK version where the substitution applies cleanly; report the issue on quarkus-awt if it persists"],"exampleFix":"// before: failing due to read-only temp\nFiles.writeString(configFile, minimalConfig, StandardCharsets.UTF_8);\n// after: point java.io.tmpdir at a writable location\n// JVM args: -Djava.io.tmpdir=C:\\\\writable\\\\tmp\nFiles.writeString(configFile, minimalConfig, StandardCharsets.UTF_8);","handlingStrategy":"try-catch","validationCode":"Path tmp = Paths.get(System.getProperty(\"java.io.tmpdir\"));\nif (!Files.isWritable(tmp)) throw new IllegalStateException(\"temp dir not writable: \" + tmp);","typeGuard":"static boolean isWritableDir(Path p) {\n  return p != null && Files.isDirectory(p) && Files.isWritable(p);\n}","tryCatchPattern":"try {\n  awtFontOperation();\n} catch (UncheckedIOException e) {\n  if (e.getMessage().startsWith(\"Failed to write Windows\")) {\n    // fix tmpdir permissions/disk and retry\n  }\n}","preventionTips":["Ensure java.io.tmpdir points to a writable, non-read-only location on Windows containers","Monitor free disk space in deployment images","Avoid mounting the temp directory read-only"],"tags":["awt","native-image","filesystem","windows"],"backgroundTag":"fontconfig-write-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}