{"record":{"id":"6482c1dfb1275022","repo":"skylot/jadx","slug":"no-loaded-files","errorCode":null,"errorMessage":"No loaded files","messagePattern":"No loaded files","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/api/JadxDecompiler.java","lineNumber":308,"sourceCode":"\tpublic ITaskExecutor getSaveTaskExecutor() {\n\t\treturn getSaveTasks(!args.isSkipSources(), !args.isSkipResources());\n\t}\n\n\t@Deprecated(forRemoval = true)\n\tpublic ExecutorService getSaveExecutor() {\n\t\tITaskExecutor executor = getSaveTaskExecutor();\n\t\texecutor.execute();\n\t\treturn executor.getInternalExecutor();\n\t}\n\n\t@Deprecated(forRemoval = true)\n\tpublic List<Runnable> getSaveTasks() {\n\t\treturn Collections.singletonList(this::save);\n\t}\n\n\tprivate TaskExecutor getSaveTasks(boolean saveSources, boolean saveResources) {\n\t\tif (root == null) {\n\t\t\tthrow new JadxRuntimeException(\"No loaded files\");\n\t\t}\n\t\tOutDirs outDirs;\n\t\tExportGradle gradleExport;\n\t\tif (args.getExportGradleType() != null) {\n\t\t\tgradleExport = new ExportGradle(root, args.getOutDir(), getResources());\n\t\t\toutDirs = gradleExport.init();\n\t\t} else {\n\t\t\tgradleExport = null;\n\t\t\toutDirs = new OutDirs(args.getOutDirSrc(), args.getOutDirRes());\n\t\t\toutDirs.makeDirs();\n\t\t}\n\n\t\tTaskExecutor executor = new TaskExecutor();\n\t\texecutor.setThreadsCount(args.getThreadsCount());\n\t\tif (saveResources) {\n\t\t\t// save resources first because decompilation can stop or fail\n\t\t\tappendResourcesSaveTasks(executor, outDirs.getResOutDir());\n\t\t}","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/api/JadxDecompiler.java#L290-L326","documentation":"Thrown by JadxDecompiler.getSaveTasks() when the internal root RootNode is null, meaning load() was never successfully called (or failed) before save() was invoked. Save requires the loaded class/resource tree, so without it there is nothing to write. It is a JadxRuntimeException (unchecked) with the literal message 'No loaded files'.","triggerScenarios":"Calling decompiler.save() or decompiler.getSaveTasks() without first calling (and completing) decompiler.load(), or calling save after a load() that threw and left root unpopulated.","commonSituations":"Programmatic integration that skips load(); a load() failure that was swallowed/ignored before save(); reordered initialization in a custom wrapper; unit tests that build a JadxDecompiler and jump straight to save.","solutions":["Always call decompiler.load() and ensure it completes without exception before calling save().","Check decompiler.getRoot() == null (or getClasses().isEmpty()) before saving to guard the call.","If load() failed, diagnose and fix that first; saving is impossible without loaded files.","Structure your wrapper so load and save cannot be called out of order."],"exampleFix":"// before\nJadxDecompiler d = new JadxDecompiler(args);\nd.save(); // root is null\n\n// after\nJadxDecompiler d = new JadxDecompiler(args);\nd.load();\nif (d.getClasses().isEmpty()) {\n    throw new IllegalStateException(\"load() produced no classes, nothing to save\");\n}\nd.save();","handlingStrategy":"validation","validationCode":"// Ensure load() ran successfully before saving.\nif (decompiler.getClasses() == null || decompiler.getClasses().isEmpty()) {\n    throw new IllegalStateException(\"No classes loaded; call load() first.\");\n}\ndecompiler.save();","typeGuard":null,"tryCatchPattern":"try {\n    decompiler.save();\n} catch (JadxRuntimeException e) {\n    if (\"No loaded files\".equals(e.getMessage())) {\n        LOG.error(\"load() was not called or failed; cannot save.\");\n    } else throw e;\n}","preventionTips":["Always call and await load() before save().","Do not swallow exceptions from load(); if it fails, do not proceed to save().","Guard save() with a non-empty classes check."],"tags":["lifecycle","state","configuration","startup"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}