{"record":{"id":"c66c2282e6be8dd4","repo":"skylot/jadx","slug":"decode-error-message-position-0x-position","errorCode":null,"errorMessage":"Decode error: ${message}, position: 0x${position}","messagePattern":"Decode error: (.+?), position: 0x(.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/xmlgen/CommonBinaryParser.java","lineNumber":50,"sourceCode":"\t\tint styleCount = is.readInt32();\n\t\tint flags = is.readInt32();\n\t\tlong stringsStart = is.readInt32();\n\t\tlong stylesStart = is.readInt32();\n\n\t\t// Correct the offset of actual strings, as the header is already read.\n\t\tstringsStart = stringsStart - (is.getPos() - start);\n\t\tbyte[] buffer = is.readInt8Array((int) (chunkEnd - is.getPos()));\n\t\tis.checkPos(chunkEnd, \"Expected strings pool end\");\n\n\t\treturn new BinaryXMLStrings(\n\t\t\t\tstringCount,\n\t\t\t\tstringsStart,\n\t\t\t\tbuffer,\n\t\t\t\t(flags & UTF8_FLAG) != 0);\n\t}\n\n\tprotected void die(String message) throws IOException {\n\t\tthrow new IOException(\"Decode error: \" + message\n\t\t\t\t+ \", position: 0x\" + Long.toHexString(is.getPos()));\n\t}\n}\n","sourceCodeStart":32,"sourceCodeEnd":54,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/xmlgen/CommonBinaryParser.java#L32-L54","documentation":"Thrown by CommonBinaryParser.die(String) as an IOException (not JadxRuntimeException) when the binary XML parser encounters a structural error in an Android binary XML resource (e.g., AndroidManifest.xml, layout XML). The message includes a human-readable reason and the current byte position (hex) in the stream. This is the parser's fatal-error signal for malformed or truncated binary XML chunks — used when expected magic numbers, chunk sizes, or string-pool boundaries don't match.","triggerScenarios":"Parsing a binary Android XML resource that is corrupted, truncated, or not actually binary XML (wrong chunk type). A malformed string pool where chunkEnd doesn't align (is.checkPos fails). Invalid header sizes or magic values in the RES_STRING_POOL_TYPE check. Deliberately malformed XML from an obfuscator or packer.","commonSituations":"Decompiling a packed/obfuscated APK with intentionally corrupted resources.arsc or AndroidManifest.xml. A truncated APK download. A resource file that was processed by an aggressive resource shrinker/proguard. An anti-decompilation tool that corrupts binary XML headers.","solutions":["Catch IOException around the parse() call and log the position for diagnosis.","Re-download or re-obtain the APK from a trusted source to rule out truncation.","Use apktool or aapt to validate the binary XML independently.","If obfuscation is suspected, try --no-debug-info or relaxed parsing options in jadx."],"exampleFix":"// before\nICodeInfo info = parser.parse(inputStream);\n\n// after — catch the IOException and degrade gracefully\ntry {\n    ICodeInfo info = parser.parse(inputStream);\n} catch (IOException e) {\n    LOG.warn(\"Binary XML parse failed: {}\", e.getMessage());\n    // fall back to raw output or skip this resource\n}","handlingStrategy":"try-catch","validationCode":"// No programmatic pre-validation possible for binary XML internals.\n// Best effort: check the file starts with a binary XML magic number.\npublic static boolean looksLikeBinaryXml(byte[] header) {\n    // Android binary XML starts with 0x00080003 (little-endian: 03 00 08 00)\n    return header != null && header.length >= 4\n        && header[0] == 0x03 && header[1] == 0x00\n        && header[2] == 0x08 && header[3] == 0x00;\n}","typeGuard":null,"tryCatchPattern":"try {\n    ICodeInfo info = parser.parse(inputStream);\n} catch (IOException e) {\n    LOG.warn(\"Binary XML decode error at {}: {}\", e.getMessage());\n    // degrade gracefully: skip resource or output raw bytes\n}","preventionTips":["Validate the APK integrity before decompiling (checksum, aapt dump).","Catch IOException around parse() and degrade gracefully for corrupted resources.","Be cautious with packed/obfuscated APKs that may intentionally corrupt binary XML."],"tags":["xml-parsing","binary-xml","corruption","obfuscation","jadx"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}