skylot/jadx · error · JadxException
Error decode: ${rf.getOriginalName()}
Error message
Error decode: ${rf.getOriginalName()} What it means
Thrown by ResourcesLoader.decodeStream() when a ResourceDecoder.decode() call fails while reading a resource entry's content. Unlike the RuntimeExceptions elsewhere, this is a checked JadxException wrapping the original IOException/exception, carrying the resource's original name. It fires for both zip-backed entries (via IZipEntry.getInputStream) and plain-file resources (via FileInputStream). The higher-level loadContent() catches it and degrades to an error-code snippet rather than crashing.
Source
Thrown at jadx-core/src/main/java/jadx/api/ResourcesLoader.java:109
public void addResTableParserProvider(IResTableParserProvider resTableParserProvider) {
resTableParserProviders.add(resTableParserProvider);
}
public static <T> T decodeStream(ResourceFile rf, ResourceDecoder<T> decoder) throws JadxException {
try {
IZipEntry zipEntry = rf.getZipEntry();
if (zipEntry != null) {
try (InputStream inputStream = zipEntry.getInputStream()) {
return decoder.decode(zipEntry.getUncompressedSize(), inputStream);
}
} else {
File file = new File(rf.getOriginalName());
try (InputStream inputStream = new BufferedInputStream(new FileInputStream(file))) {
return decoder.decode(file.length(), inputStream);
}
}
} catch (Exception e) {
throw new JadxException("Error decode: " + rf.getOriginalName(), e);
}
}
static ResContainer loadContent(JadxDecompiler jadxRef, ResourceFile rf) {
try {
ResourcesLoader resLoader = jadxRef.getResourcesLoader();
return decodeStream(rf, (size, is) -> resLoader.loadContent(rf, is));
} catch (JadxException e) {
LOG.error("Decode error", e);
ICodeWriter cw = jadxRef.getRoot().makeCodeWriter();
cw.add("Error decode ").add(rf.getType().toString().toLowerCase());
Utils.appendStackTrace(cw, e.getCause());
return ResContainer.textResource(rf.getDeobfName(), cw.finish());
}
}
private ResContainer loadContent(ResourceFile resFile, InputStream inputStream) throws IOException {
for (IResContainerFactory customFactory : resContainerFactories) {View on GitHub (pinned to e738a26571)
Solutions
- Inspect getCause() to see the decode-specific error (image lib, XML parser, ARSC parser).
- Use the higher-level loadContent() which already catches JadxException and returns an error placeholder instead of propagating.
- Skip the offending resource and continue with the rest.
- Verify the resource bytes are intact (re-extract/re-download the archive).
Example fix
// before
T result = ResourcesLoader.decodeStream(rf, (size, is) -> decoder.decode(size, is));
// after
T result;
try {
result = ResourcesLoader.decodeStream(rf, (size, is) -> decoder.decode(size, is));
} catch (JadxException e) {
LOG.warn("Failed to decode resource {}, skipping: {}", rf.getOriginalName(), e.getCause());
result = null;
} Defensive patterns
Strategy: try-catch
Validate before calling
// Prefer the higher-level loadContent() which already catches JadxException
// and degrades to an error-code placeholder. If calling decodeStream directly,
// guard the decoder:
Objects.requireNonNull(decoder, "decoder");
if (rf.getType() == null) throw new JadxException("Unknown resource type for " + rf.getOriginalName()); Try / catch
try {
return ResourcesLoader.decodeStream(rf, (size, is) -> decoder.decode(size, is));
} catch (JadxException e) {
LOG.warn("Decode failed for {}: {}", rf.getOriginalName(), e.getCause());
return null; // or an error placeholder
} Prevention
- Use loadContent() instead of decodeStream() to get built-in error degradation.
- Inspect getCause() for the format-specific decode error.
- Skip corrupt resources and continue rather than aborting the whole batch.
When it happens
Trigger: Decoding a ResourceFile (image, XML, binary resource) through a ResourceDecoder whose decode(size, inputStream) throws, for an entry whose underlying stream is corrupt or whose format the decoder cannot parse.
Common situations: A malformed binary resource (e.g., a corrupt .arsc, a truncated .png, a 9-patch that fails decoding); a resource type mismatch where the decoder chosen for the extension cannot parse the bytes; a zip entry whose stream throws mid-read; disk I/O errors on an extracted resource.
Related errors
- Failed to init res table provider: ${resTableParserProvider}
- Failed to init res container factory: ${resContainerFactory}
- Unknown type of resource file: ${resFile.getOriginalName()}
- Failed to open zip file: ${file.getAbsolutePath()}
- Gradle export failed
AI-assisted analysis of skylot/jadx@e738a26571 (2026-08-14).
Data as JSON: /api/errors/510dc605bfbc832f.
Report an issue: GitHub.