{"record":{"id":"3570dafa4e54d6ca","repo":"hibernate/hibernate-orm","slug":"file-believed-to-exist-based-on-file-exists-threw","errorCode":null,"errorMessage":"File believed to exist based on File.exists threw error when passed to FileInputStream ctor","messagePattern":"File believed to exist based on File\\.exists threw error when passed to FileInputStream ctor","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"hibernate-core/src/main/java/org/hibernate/boot/archive/internal/FileInputStreamAccess.java","lineNumber":45,"sourceCode":"\t\tthis.file = file;\n\t\tif ( ! file.exists() ) {\n\t\t\tthrow new HibernateException( \"File must exist : \" + file.getAbsolutePath() );\n\t\t}\n\t}\n\n\t@Override\n\tpublic String getStreamName() {\n\t\treturn name;\n\t}\n\n\t@Override\n\tpublic InputStream accessInputStream() {\n\t\ttry {\n\t\t\treturn new BufferedInputStream( new FileInputStream( file ) );\n\t\t}\n\t\tcatch (FileNotFoundException e) {\n\t\t\t// should never ever ever happen, but...\n\t\t\tthrow new ArchiveException(\n\t\t\t\t\t\"File believed to exist based on File.exists threw error when passed to FileInputStream ctor\",\n\t\t\t\t\te\n\t\t\t);\n\t\t}\n\t}\n}\n","sourceCodeStart":27,"sourceCodeEnd":52,"githubUrl":"https://github.com/hibernate/hibernate-orm/blob/fad1729dce015f908198d57a8d80274a30f905a5/hibernate-core/src/main/java/org/hibernate/boot/archive/internal/FileInputStreamAccess.java#L27-L52","documentation":"Thrown by FileInputStreamAccess when File.exists() returned true but creating a FileInputStream still failed with FileNotFoundException. This indicates a race (file deleted between checks) or a permission/filesystem issue.","triggerScenarios":"The archive file existed when checked but opening it failed: the file was deleted concurrently, is a directory, or the process lacks read permission.","commonSituations":"Concurrent build/clean processes deleting jars while the application starts; read-only or restricted mount points; SELinux or container filesystem restrictions.","solutions":["Ensure no build or cleanup process deletes the archive while Hibernate is starting.","Check file permissions so the JVM user can read the file.","Confirm the path is a regular file, not a directory or dangling symlink."],"exampleFix":"The file passed a File.exists check but failed to open, typically due to permissions or a race where the file was deleted between the check and the open. Check file permissions and avoid concurrent deletion of the archive.","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fad1729dce015f908198d57a8d80274a30f905a5","analyzedAt":"2026-08-22T04:13:57.527Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}