{"record":{"id":"af02ce18c76f387e","repo":"iBotPeaches/Apktool","slug":"could-not-decode-raw-stream","errorCode":null,"errorMessage":"Could not decode raw stream.","messagePattern":"Could not decode raw stream\\.","errorType":"exception","errorClass":"AndrolibException","httpStatus":null,"severity":"error","filePath":"brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResRawStreamDecoder.java","lineNumber":33,"sourceCode":" *  limitations under the License.\n */\npackage brut.androlib.res.decoder;\n\nimport brut.androlib.exceptions.AndrolibException;\nimport org.apache.commons.io.IOUtils;\n\nimport java.io.InputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\n\npublic class ResRawStreamDecoder implements ResStreamDecoder {\n\n    @Override\n    public void decode(InputStream in, OutputStream out) throws AndrolibException {\n        try {\n            IOUtils.copy(in, out);\n        } catch (IOException ex) {\n            throw new AndrolibException(\"Could not decode raw stream.\", ex);\n        }\n    }\n}\n","sourceCodeStart":15,"sourceCodeEnd":37,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/decoder/ResRawStreamDecoder.java#L15-L37","documentation":"Thrown by ResRawStreamDecoder.decode() when IOUtils.copy(in, out) fails with an IOException while copying a raw (undecoded) resource file. This decoder is the pass-through used for assets and files with no special format (Type.UNKNOWN), so any read error on the source zip entry or write error on the destination file lands here, wrapped in AndrolibException.","triggerScenarios":"A truncated or CRC-corrupt zip entry for the resource file; the output directory being unwritable or full; the source APK being modified/deleted mid-decode; streams closed externally.","commonSituations":"Disk-full during apktool d; read-only or permission-restricted output dirs; APKs with deliberately corrupted entries (anti-tamper); network drives dropping during decode.","solutions":["Check disk space and write permissions on the output directory before decoding.","Verify the APK zip integrity (unzip -t) and re-download if entries are corrupt.","Do not touch or re-sign the APK while a decode is running.","If the entry is intentionally corrupt, catch AndrolibException per file and skip it (apktool's public ResFileDecoder path already substitutes ResPrimitive.NULL with a warning)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Ensure output target is writable and disk has space before decode\nFiles.createDirectories(outDir);\nif (outDir.toFile().getFreeSpace() < apkLength) throw new IOException(\"Insufficient disk space\");","typeGuard":null,"tryCatchPattern":"try {\n    decoder.decode(in, out);\n} catch (AndrolibException ex) {\n    if (ex.getCause() instanceof IOException) {\n        // source entry unreadable or destination unwritable; skip file with warning\n    }\n}","preventionTips":["Pre-flight check disk space and output permissions","Validate zip entry CRCs before decode","Do not modify or move the APK mid-decode"],"tags":["android","apktool","io","raw-copy","disk-full"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}