{"record":{"id":"cdfdf1932bff0a38","repo":"elastic/elasticsearch","slug":"support-only-file-path","errorCode":null,"errorMessage":"Support only file!: ${path}","messagePattern":"Support only file!: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchBuildCompletePlugin.java","lineNumber":303,"sourceCode":"\n        }\n\n        private static void createBuildArchiveTar(List<File> files, File projectDir, File uploadFile) {\n            try (\n                OutputStream fOut = Files.newOutputStream(uploadFile.toPath());\n                BufferedOutputStream buffOut = new BufferedOutputStream(fOut);\n                BZip2CompressorOutputStream bzOut = new BZip2CompressorOutputStream(buffOut);\n                TarArchiveOutputStream tOut = new TarArchiveOutputStream(bzOut)\n            ) {\n                Path projectPath = projectDir.toPath();\n                tOut.setLongFileMode(TarArchiveOutputStream.LONGFILE_GNU);\n                tOut.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_STAR);\n                for (Path path : files.stream().map(File::toPath).toList()) {\n                    if (Files.exists(path) == false) {\n                        log.warn(\"File disappeared before it could be added to CI archive: \" + path);\n                        continue;\n                    } else if (!Files.isRegularFile(path)) {\n                        throw new IOException(\"Support only file!: \" + path);\n                    }\n\n                    long entrySize = Files.size(path);\n                    TarArchiveEntry tarEntry = new TarArchiveEntry(path.toFile(), calculateArchivePath(path, projectPath));\n                    tarEntry.setSize(entrySize);\n                    tOut.putArchiveEntry(tarEntry);\n\n                    // copy file to TarArchiveOutputStream\n                    try (BufferedInputStream bin = new BufferedInputStream(Files.newInputStream(path))) {\n                        IOUtils.copyLarge(bin, tOut, 0, entrySize);\n                    }\n                    tOut.closeArchiveEntry();\n\n                }\n                tOut.flush();\n                tOut.finish();\n\n            } catch (IOException e) {","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/ElasticsearchBuildCompletePlugin.java#L285-L321","documentation":"Thrown by ElasticsearchBuildCompletePlugin during CI-archive tar creation when a path in the file set is not a regular file (e.g. a directory, a special file, or a broken symlink). The archiver copies file contents into a tar.bz2 stream and only handles regular files.","triggerScenarios":"A configured archive input resolves to a directory or non-regular file, or a file was replaced by a directory/symlink between enumeration and the Files.isRegularFile check.","commonSituations":"An archive glob accidentally matched a directory; a symlink target is missing; a generated artifact path changed shape between configuration and execution.","solutions":["Filter the input set so only regular files are passed to the archiver (Files.isRegularFile check at configuration time).","Resolve symlinks before archiving or exclude them.","Verify each configured path points at a file, not a directory.","Handle the 'file disappeared' log warning to distinguish deletion vs non-regular cases."],"exampleFix":"// before\nfor (Path path : files.stream().map(File::toPath).toList()) { /* archiver errors on dirs */ }\n// after\nList<Path> regularOnly = files.stream().map(File::toPath).filter(Files::isRegularFile).toList();","handlingStrategy":"validation","validationCode":"List<Path> regularOnly = files.stream()\n    .map(File::toPath)\n    .filter(p -> Files.exists(p) && Files.isRegularFile(p))\n    .toList();\nif (regularOnly.size() != files.size()) {\n    log.warn(\"Some archive inputs were not regular files and were skipped\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    if (!Files.isRegularFile(path)) throw new IOException(\"Support only file!: \" + path);\n} catch (IOException e) {\n    log.warn(\"Skipping non-regular archive input: \" + path, e);\n}","preventionTips":["Filter archive input sets to regular files at configuration time.","Resolve or exclude symlinks before archiving.","Log the 'file disappeared' branch distinctly so transient deletions are visible."],"tags":["ci-archive","tar","io","build-tools"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T08:17:17.861Z"}