{"record":{"id":"347183689f5efcc5","repo":"quarkusio/quarkus","slug":"unable-to-write-the-model-to-yamlmodelpath","errorCode":null,"errorMessage":"Unable to write the model to: ${yamlModelPath}","messagePattern":"Unable to write the model to: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"core/processor/src/main/java/io/quarkus/annotation/processor/util/FilerUtil.java","lineNumber":182,"sourceCode":"            processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, \"Failed to write \" + filePath + \": \" + e);\n            return;\n        }\n    }\n\n    /**\n     * The model files are written outside of target/classes as we don't want to include them in the jar.\n     * <p>\n     * They are not written by the annotation processor Filer API so we can use proper Paths.\n     */\n    public Path writeModel(String filePath, Object value) {\n        Path yamlModelPath = getTargetPath().resolve(filePath);\n        try {\n            Files.createDirectories(yamlModelPath.getParent());\n            JacksonMappers.yamlObjectWriter().writeValue(yamlModelPath.toFile(), value);\n\n            return yamlModelPath;\n        } catch (IOException e) {\n            throw new IllegalStateException(\"Unable to write the model to: \" + yamlModelPath, e);\n        }\n    }\n\n    public Path getTargetPath() {\n        try {\n            FileObject dummyFile = processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, \"\", \"dummy\");\n            return Paths.get(dummyFile.toUri()).getParent().getParent();\n        } catch (IOException e) {\n            processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, \"Unable to determine the path of target/\" + e);\n            throw new UncheckedIOException(e);\n        }\n    }\n\n    public Optional<Path> getPomPath() {\n        try {\n            Path pomPath = Paths.get(processingEnv.getFiler().getResource(StandardLocation.CLASS_OUTPUT, \"\", \"dummy\").toUri())\n                    .getParent().getParent().getParent().resolve(\"pom.xml\");\n","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/core/processor/src/main/java/io/quarkus/annotation/processor/util/FilerUtil.java#L164-L200","documentation":"The processor serializes the generated config documentation model (a YAML file) under the module's target directory. FilerUtil.writeModel creates the parent directories and writes via Jackson's YAML mapper; any IOException during directory creation or file writing is wrapped in this IllegalStateException. The build fails because the docs model could not be persisted.","triggerScenarios":"Writing the YAML model when the target directory cannot be created (permissions, read-only filesystem, disk full) or the output file cannot be opened/overwritten (locked by another process, path too long, permission denied).","commonSituations":"Read-only CI workspaces or NFS mounts; another build process holding target/quarkus-config-doc* files; disk quota exceeded; running builds concurrently on the same module.","solutions":["Check the path in the message: ensure target/ is writable and has free disk space (df -h, ls -ld target).","Stop other builds and remove stale locks: kill parallel mvn processes and run ./mvnw clean, then rebuild.","Run the build as a user with write access to the project directory, or fix mount permissions.","Retry the build; if intermittent, avoid running multiple builds of the same module concurrently."],"exampleFix":"// before (read-only output dir)\nchmod 555 target && ./mvnw install\n// after\nchmod 755 target && ./mvnw clean install","handlingStrategy":"try-catch","validationCode":"Path out = Paths.get(\"target\", \"quarkus-config-doc\");\nif (!Files.isWritable(out.getParent())\n        || Files.getFileStore(out.getParent()).getTotalSpace()\n               - Files.getFileStore(out.getParent()).getUsableSpace() < 0) {\n    throw new IllegalStateException(\"target/ not writable\");\n}","typeGuard":"boolean canWriteModel(Path yamlModelPath) {\n    Path parent = yamlModelPath.getParent();\n    return parent != null && Files.isWritable(parent);\n}","tryCatchPattern":"try {\n    build();\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Unable to write the model to\")) {\n        cleanTargetAndRetry();\n    } else throw e;\n}","preventionTips":["Keep target/ directories writable by the build user.","Don't run multiple Maven builds of the same module concurrently.","Monitor disk space in CI runners.","Run ./mvnw clean if target files are stale or locked."],"tags":["quarkus","annotation-processor","io","yaml","filesystem"],"backgroundTag":"file-write-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}