{"record":{"id":"419263d128da9cd1","repo":"skylot/jadx","slug":"failed-to-create-temp-file-with-suffix-suffix","errorCode":null,"errorMessage":"Failed to create temp file with suffix: ${suffix}","messagePattern":"Failed to create temp file with suffix: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java","lineNumber":267,"sourceCode":"\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\n\t/**\n\t * Deprecated.\n\t * Prefer {@link IJadxFilesGetter} from jadx args to get temp dir\n\t */\n\t@Deprecated\n\tpublic static Path createTempFileNoDelete(String suffix) {\n\t\ttry {\n\t\t\treturn Files.createTempFile(Files.createTempDirectory(\"jadx-persist\"), \"jadx-\", suffix);\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\n\t/**\n\t * Deprecated.","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/utils/files/FileUtils.java#L249-L285","documentation":"Thrown by createTempFile(String suffix) when Files.createTempFile(tempRootDir, JADX_TMP_PREFIX, suffix) fails. The temp file is created under jadx's managed tempRootDir with a fixed 'jadx-tmp-' prefix. Failure causes: tempRootDir missing/unwritable, suffix contains illegal characters or path separators, disk full, or inode exhaustion. The method is deprecated.","triggerScenarios":"Calling createTempFile when tempRootDir was deleted. The suffix contains a path separator or illegal filename character. The temp filesystem is out of space or inodes. Permission on tempRootDir changed after startup.","commonSituations":"Calling after clearTempRootDir removed the root. Deprecated API usage not yet migrated. Large decompilation jobs exhausting temp disk. Invalid suffix string from dynamic configuration.","solutions":["Migrate to IJadxFilesGetter from jadx args as the deprecation notice advises.","Sanitize the suffix: strip path separators and OS-illegal characters.","Ensure tempRootDir exists and is writable before calling.","Monitor free disk space during long decompilation runs."],"exampleFix":"// before (deprecated)\nPath tmp = FileUtils.createTempFile(\".dex\");\n\n// after — use IJadxFilesGetter\nPath tmp = args.getFilesGetter().createTempFile(\".dex\");","handlingStrategy":"validation","validationCode":"public static boolean isValidTempSuffix(String suffix) {\n    return suffix != null && !suffix.contains(\"/\") && !suffix.contains(\"\\\\\")\n        && suffix.matches(\"[a-zA-Z0-9._-]*\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    Path tmp = FileUtils.createTempFile(suffix);\n} catch (JadxRuntimeException e) {\n    LOG.error(\"cannot create temp file with suffix '{}': {}\", suffix, e.getCause().getMessage());\n    throw e;\n}","preventionTips":["Migrate from the deprecated method to IJadxFilesGetter.","Sanitize suffix strings to remove path separators and illegal characters.","Ensure tempRootDir exists and is writable."],"tags":["temp-file","deprecated","filesystem","permissions","jadx"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}