{"record":{"id":"ae7b26135c6d96c5","repo":"skylot/jadx","slug":"failed-to-create-temp-directory-with-suffix-pre","errorCode":null,"errorMessage":"Failed to create temp directory with suffix: ${prefix}","messagePattern":"Failed to create temp directory with suffix: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java","lineNumber":252,"sourceCode":"\t\ttry {\n\t\t\tdeleteDir(clearDir, true);\n\t\t} catch (Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Failed to clear directory \" + clearDir, e);\n\t\t}\n\t}\n\n\t/**\n\t * Deprecated.\n\t * Migrate to {@link IJadxFilesGetter} from jadx args to get temp dir\n\t */\n\t@Deprecated\n\tpublic static Path createTempDir(String prefix) {\n\t\ttry {\n\t\t\tPath dir = Files.createTempDirectory(tempRootDir, prefix);\n\t\t\tdir.toFile().deleteOnExit();\n\t\t\treturn dir;\n\t\t} catch (Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Failed to create temp directory with suffix: \" + prefix, e);\n\t\t}\n\t}\n\n\t/**\n\t * Deprecated.\n\t * Migrate to {@link IJadxFilesGetter} from jadx args to get temp dir\n\t */\n\t@Deprecated\n\tpublic static Path createTempFile(String suffix) {\n\t\ttry {\n\t\t\tPath path = Files.createTempFile(tempRootDir, JADX_TMP_PREFIX, suffix);\n\t\t\tpath.toFile().deleteOnExit();\n\t\t\treturn path;\n\t\t} catch (Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Failed to create temp file with suffix: \" + suffix, e);\n\t\t}\n\t}\n","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java#L234-L270","documentation":"Thrown by createTempDir(String prefix) when Files.createTempDirectory(tempRootDir, prefix) fails. This creates a temp directory under jadx's managed tempRootDir. Failure means the tempRootDir itself does not exist, is not writable, the prefix is invalid (contains path separators or illegal characters), or disk/inode space is exhausted. The method is deprecated in favor of IJadxFilesGetter.","triggerScenarios":"Calling createTempDir when tempRootDir was deleted or cleared between initialization and this call. The prefix string contains path separators or characters illegal for filenames. The temp filesystem is full or out of inodes. tempRootDir permissions changed after JVM startup.","commonSituations":"Calling this after clearTempRootDir() has removed the root. In a long-running jadx process where the OS cleaned up /tmp. Deprecated API usage in code that hasn't migrated to IJadxFilesGetter. Disk full in CI.","solutions":["Migrate to IJadxFilesGetter from jadx args as the deprecation notice advises.","Ensure tempRootDir still exists before calling: FileUtils.isTempRootDirValid() or check Files.isDirectory(tempRootDir).","Avoid path separators and OS-illegal characters in the prefix string.","Verify free disk space and inodes on the temp filesystem."],"exampleFix":"// before (deprecated)\nPath dir = FileUtils.createTempDir(\"extract-\");\n\n// after — use IJadxFilesGetter from args\nPath dir = args.getFilesGetter().createTempDir(\"extract-\");","handlingStrategy":"validation","validationCode":"public static boolean canCreateTempUnderRoot() {\n    try {\n        return Files.isDirectory(Path.of(System.getProperty(\"java.io.tmpdir\")));\n    } catch (Exception e) {\n        return false;\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    Path dir = FileUtils.createTempDir(prefix);\n} catch (JadxRuntimeException e) {\n    LOG.error(\"cannot create temp dir with prefix '{}': {}\", prefix, e.getCause().getMessage());\n    throw e;\n}","preventionTips":["Migrate from the deprecated method to IJadxFilesGetter from jadx args.","Ensure the tempRootDir has not been cleared before calling.","Avoid path separators and illegal characters in the prefix."],"tags":["temp-dir","deprecated","filesystem","permissions","jadx"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}