{"record":{"id":"3370dbc8926445fe","repo":"eclipse-vertx/vert.x","slug":"unable-to-create-temporary-file-with-prefix-pre","errorCode":null,"errorMessage":"Unable to create temporary file with prefix '${prefix}' and suffix '${suffix}' at ${parentDir}","messagePattern":"Unable to create temporary file with prefix '(.+?)' and suffix '(.+?)' at (.+?)","errorType":"exception","errorClass":"FileSystemException","httpStatus":null,"severity":"error","filePath":"vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java","lineNumber":797,"sourceCode":"            Path dir = resolveFile(parentDir).toPath();\n            if (attrs != null) {\n              tmpFile = Files.createTempFile(dir, prefix, suffix, attrs);\n            } else {\n              tmpFile = Files.createTempFile(dir, prefix, suffix);\n            }\n          } else {\n            if (attrs != null) {\n              tmpFile = Files.createTempFile(prefix, suffix, attrs);\n            } else {\n              tmpFile = Files.createTempFile(prefix, suffix);\n            }\n          }\n          return tmpFile.toFile().getAbsolutePath();\n        } catch (IOException e) {\n          final String message = \"Unable to create temporary file with prefix '\" + prefix\n            + \"' and suffix '\" + suffix\n            + \"' at \" + parentDir;\n          throw new FileSystemException(message, e);\n        }\n      }\n    };\n  }\n\n  private BlockingAction<List<String>> readDirInternal(String path) {\n    return readDirInternal(path, null);\n  }\n\n  private BlockingAction<List<String>> readDirInternal(String p, String filter) {\n    Objects.requireNonNull(p);\n    return new BlockingAction<List<String>>() {\n      public List<String> perform() {\n        try {\n          File file = resolveFile(p);\n          if (!file.exists()) {\n            throw new FileSystemException(\"Cannot read directory \" + file + \". Does not exist\");\n          }","sourceCodeStart":779,"sourceCodeEnd":815,"githubUrl":"https://github.com/eclipse-vertx/vert.x/blob/fb308bd8c3f12c79f4ae89bef67fadf6c80d036e/vertx-core/src/main/java/io/vertx/core/file/impl/FileSystemImpl.java#L779-L815","documentation":"Vert.x's FileSystemImpl throws this FileSystemException when it fails to create a temporary file via File.createTempFile (or equivalent) for operations like unzipping resources to a temp location. The wrapped IOException (cause) holds the underlying OS-level reason, such as a missing, read-only, or full temp directory.","triggerScenarios":"Calling a Vert.x FileSystem/API operation that needs a scratch temp file (e.g. resolving a classpath resource by extracting it) when java.io.tmpdir is missing, not writable, or the disk is full.","commonSituations":"Containers running with a read-only root filesystem, TMPDIR pointing to a deleted directory, disk quota exceeded on /tmp, or security manager/file-permission restrictions blocking temp file creation.","solutions":["Check that the parent directory (usually java.io.tmpdir) exists and is writable by the process user","Free disk space or raise the quota on the temp filesystem","Set -Djava.io.tmpdir to a valid writable directory, or set the TMPDIR env var accordingly","Inspect the chained cause IOException for the precise OS error and fix that underlying issue"],"exampleFix":"// before (read-only /tmp in container)\njava -jar app.jar\n// after\njava -Djava.io.tmpdir=/var/tmp -jar app.jar","handlingStrategy":"try-catch","validationCode":"java.io.File tmp = new File(System.getProperty(\"java.io.tmpdir\"));\nif (!tmp.isDirectory() || !tmp.canWrite() || tmp.getUsableSpace() < 1024*1024) {\n  throw new IllegalStateException(\"Temp directory not usable: \" + tmp);\n}","typeGuard":null,"tryCatchPattern":"try {\n  fs.readFile(path);\n} catch (FileSystemException e) {\n  logger.error(\"temp file creation failed: \" + e.getCause(), e);\n  // redirect java.io.tmpdir or free disk space, then retry\n}","preventionTips":["Ensure java.io.tmpdir exists and is writable in all deployment environments","Monitor disk space on the temp filesystem","In containers, avoid read-only root or mount a writable tmpfs at /tmp"],"tags":["filesystem","io","temp-file"],"backgroundTag":"file-write-failed","analyzedSha":"fb308bd8c3f12c79f4ae89bef67fadf6c80d036e","analyzedAt":"2026-09-06T11:37:12.241Z","contentChangedAt":"2026-09-06T11:37:12.241Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}