{"record":{"id":"24c6344387ca423a","repo":"elastic/elasticsearch","slug":"failed-to-create-marker-file","errorCode":null,"errorMessage":"Failed to create marker file","messagePattern":"Failed to create marker file","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/SplitPackagesAuditTask.java","lineNumber":197,"sourceCode":"                            .details(fullMessage)\n                            .solution(\"Choose a new package name for the classes added. DO NOT add these to the ignore list.\")\n                    )\n                );\n            }\n            if (splitPackages.isEmpty() == false) {\n                throw reporter.throwing(\n                    new GradleException(\n                        \"Verification failed: Split packages found! See errors above for details.\\n\"\n                            + \"DO NOT ADD THESE SPLIT PACKAGES TO THE IGNORE LIST! Choose a new package name for the classes added.\"\n                    ),\n                    problems\n                );\n            }\n\n            try {\n                Files.write(parameters.getMarkerFile().getAsFile().get().toPath(), new byte[] {}, StandardOpenOption.CREATE);\n            } catch (IOException e) {\n                throw new RuntimeException(\"Failed to create marker file\", e);\n            }\n        }\n\n        private Map<String, List<File>> getDependencyPackages() {\n            Map<String, List<File>> packages = new HashMap<>();\n            for (File classpathElement : getParameters().getClasspath().getFiles()) {\n                for (String packageName : readPackages(classpathElement)) {\n                    packages.computeIfAbsent(packageName, k -> new ArrayList<>()).add(classpathElement);\n                }\n            }\n            if (LOGGER.isInfoEnabled()) {\n                List<String> msg = new ArrayList<>();\n                msg.add(\"Packages from dependencies:\");\n                packages.entrySet()\n                    .stream()\n                    .sorted(Map.Entry.comparingByKey())\n                    .forEach(e -> msg.add(\"  -\" + e.getKey() + \" -> \" + e.getValue()));\n                LOGGER.info(String.join(System.lineSeparator(), msg));","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/precommit/SplitPackagesAuditTask.java#L179-L215","documentation":"Thrown by SplitPackagesAuditTask when writing the success marker file (Files.write on parameters.getMarkerFile()) raises an IOException. The split-package audit itself passed, but the task could not record that fact — without the marker the task re-runs every build, so it is treated as a hard failure.","triggerScenarios":"The marker file's parent directory does not exist or is not writable, or a generic I/O error occurs while creating the (empty) marker file.","commonSituations":"The build output directory was cleaned/deleted out-of-band; the marker path points to a read-only location; disk full or permission denied in the build dir; an antivirus/locker holding the file on Windows.","solutions":["Inspect the wrapped IOException for the exact path and OS error.","Ensure the marker file's parent directory is created and writable (the task should be configured with a build-dir-relative output).","Run a clean build so the output tree is regenerated consistently.","On Windows, close any process locking the build directory."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure marker parent exists before the task runs\nFile marker = parameters.getMarkerFile().getAsFile().get();\nmarker.getParentFile().mkdirs();\nif (!marker.getParentFile().canWrite()) throw new GradleException(\"Marker dir not writable: \" + marker.getParentFile());","typeGuard":null,"tryCatchPattern":"try {\n    Files.write(marker.toPath(), new byte[] {}, StandardOpenOption.CREATE);\n} catch (IOException e) {\n    // retry once after mkdirs, then escalate\n    marker.getParentFile().mkdirs();\n    Files.write(marker.toPath(), new byte[] {}, StandardOpenOption.CREATE);\n}","preventionTips":["Always place marker files under the build directory so they are writable and cleanable.","Run `./gradlew clean` to regenerate a consistent output tree.","On Windows, ensure no process locks the build directory."],"tags":["gradle","split-packages","precommit","io","marker-file"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:17:08.281Z"}