{"record":{"id":"19bd2f4d052af8ab","repo":"OpenAPITools/openapi-generator","slug":"failed-to-generate-openapi-generator-ignore-when","errorCode":null,"errorMessage":"Failed to generate .openapi-generator-ignore when the option `openapiGeneratorIgnoreList` is enabled: ","messagePattern":"Failed to generate \\.openapi-generator-ignore when the option `openapiGeneratorIgnoreList` is enabled: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java","lineNumber":1084,"sourceCode":"                    \"#docs/*.md\",\n                    \"# Then explicitly reverse the ignore rule for a single file:\",\n                    \"#!docs/README.md\",\n                    \"\",\n                    \"# The following entries are pre-populated based on the input obtained via\",\n                    \"# the option `openapiGeneratorIgnoreList` (--openapi-generator-ignore-list in CLI for example).\",\n                    \"\");\n            Writer fileWriter = Files.newBufferedWriter(ignoreFile.toPath(), StandardCharsets.UTF_8);\n            fileWriter.write(header);\n            // add entries provided by the users\n            for (String entry : config.getOpenapiGeneratorIgnoreList()) {\n                fileWriter.write(entry);\n                fileWriter.write(\"\\n\");\n            }\n            fileWriter.close();\n            // re-create ignore processor based on the newly-created .openapi-generator-ignore\n            this.ignoreProcessor = new CodegenIgnoreProcessor(ignoreFile);\n        } catch (IOException e) {\n            throw new RuntimeException(\"Failed to generate .openapi-generator-ignore when the option `openapiGeneratorIgnoreList` is enabled: \", e);\n        }\n    }\n\n    private void generateSupportingFiles(List<File> files, Map<String, Object> bundle) {\n        if (!generateSupportingFiles) {\n            // TODO: process these anyway and report via dryRun?\n            LOGGER.info(\"Skipping generation of supporting files.\");\n            return;\n        }\n\n        Set<String> supportingFilesToGenerate = getPropertyAsSet(CodegenConstants.SUPPORTING_FILES);\n        for (SupportingFile support : config.supportingFiles()) {\n            try {\n                String outputFolder = config.outputFolder();\n                if (StringUtils.isNotEmpty(support.getFolder())) {\n                    outputFolder += File.separator + support.getFolder();\n                }\n                File of = new File(outputFolder);","sourceCodeStart":1066,"sourceCodeEnd":1102,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultGenerator.java#L1066-L1102","documentation":"DefaultGenerator.generateOpenapiGeneratorIgnoreFile (line 1023) runs when the openapiGeneratorIgnoreList option is non-empty: it writes a .openapi-generator-ignore file containing the user's entries, then rebuilds the ignore processor from it. The catch of IOException from Files.newBufferedWriter/write/close is rethrown with this message. This is virtually always a filesystem condition, not a spec problem: the output directory does not exist, is not writable, the disk is full, or the file is locked by another process.","triggerScenarios":"Setting openapiGeneratorIgnoreList (e.g. --additional-properties openapiGeneratorIgnoreList=<entries>, or config.setOpenapiGeneratorIgnoreList(...)) while the configured output folder does not exist or is read-only; the target .openapi-generator-ignore being held open by an editor/IDE/antivirus on Windows; generating into a read-only Docker volume; ENOSPC.","commonSituations":"CI pipelines generating into a workspace owned by another user; containerized runs with a read-only bind mount for the output; local runs where the previous output folder is open in a file watcher; disk-full conditions on shared agents.","solutions":["Ensure the output directory exists and is writable by the generating process (mkdir -p <out>; ls -ld <out>) before running.","Close any editor/IDE/antivirus holding .openapi-generator-ignore open, or generate into a fresh output directory (-o /tmp/fresh-out) to confirm.","Check disk space (df -h) and mount options (read-only volumes) if running in a container.","If the ignore list is not actually needed, drop the openapiGeneratorIgnoreList option so the default ignore-file path (error [7]) or none applies instead."],"exampleFix":"# before\nopenapi-generator generate -g java -i api.yaml -o out \\\n  --additional-properties openapiGeneratorIgnoreList=src/main/old/\n# after: pre-create and verify the output directory first\nmkdir -p out && openapi-generator generate -g java -i api.yaml -o out \\\n  --additional-properties openapiGeneratorIgnoreList=src/main/old/","handlingStrategy":"validation","validationCode":"// Pre-flight the output directory before enabling openapiGeneratorIgnoreList\nPath out = Path.of(config.outputFolder());\nFiles.createDirectories(out);\nPath ignore = out.resolve(\".openapi-generator-ignore\");\nif (Files.exists(ignore) && !Files.isWritable(ignore)) {\n    throw new IllegalStateException(\"Ignore file not writable: \" + ignore);\n}\nif (!Files.isWritable(out)) {\n    throw new IllegalStateException(\"Output dir not writable: \" + out);\n}","typeGuard":null,"tryCatchPattern":"try {\n    generator.opts(input).generate();\n} catch (RuntimeException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"openapi-generator-ignore\")\n            && e.getCause() instanceof java.io.IOException) {\n        // filesystem condition: surface actionable message, do not retry blindly\n        throw new GenerationFailure(\"Cannot write ignore file - check output dir permissions\", e.getCause());\n    }\n    throw e;\n}","preventionTips":["Create and permission the output directory in the build script before generation.","On CI, write output to a directory the build user owns.","Close/stop file watchers that lock .openapi-generator-ignore on Windows."],"tags":["openapi-generator","io","filesystem","ignore-file","permissions"],"backgroundTag":"file-write-permission","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}