{"record":{"id":"e014236acef1e05a","repo":"iBotPeaches/Apktool","slug":"repeated-entry-pkgid-0x-02x-typeid-0x-02x-entry","errorCode":null,"errorMessage":"Repeated entry: pkgId=0x%02x, typeId=0x%02x, entryId=0x%04x, config=%s","messagePattern":"Repeated entry: pkgId=0x%02x, typeId=0x%02x, entryId=0x%04x, config=(.+?)","errorType":"exception","errorClass":"AndrolibException","httpStatus":null,"severity":"error","filePath":"brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResPackage.java","lineNumber":270,"sourceCode":"        return entry;\n    }\n\n    public ResEntry addEntry(int typeId, int entryId, ResValue value) throws AndrolibException {\n        return addEntry(typeId, entryId, ResConfig.DEFAULT, value);\n    }\n\n    public ResEntry addEntry(int typeId, int entryId, ResConfig config, ResValue value) throws AndrolibException {\n        ResId resId = ResId.of(getId(), typeId, entryId);\n        if (mAliases.containsKey(resId)) {\n            resId = mAliases.get(resId);\n            typeId = resId.typeId();\n            entryId = resId.entryId();\n        }\n\n        Pair<ResId, ResConfig> entryKey = Pair.of(resId, config);\n        ResEntry entry = mEntries.get(entryKey);\n        if (entry != null) {\n            throw new AndrolibException(\n                String.format(\"Repeated entry: pkgId=0x%02x, typeId=0x%02x, entryId=0x%04x, config=%s\",\n                    getId(), typeId, entryId, config));\n        }\n\n        ResEntrySpec entrySpec = getEntrySpec(typeId, entryId);\n        Pair<Integer, ResConfig> typeKey = Pair.of(typeId, config);\n        ResType type = mTypes.get(typeKey);\n        if (type == null) {\n            // We can safely create the type if it's missing.\n            ResTypeSpec typeSpec = getTypeSpec(typeId);\n            type = new ResType(typeSpec, config);\n            mTypes.put(typeKey, type);\n        }\n\n        entry = new ResEntry(type, entrySpec, value);\n        mEntries.put(entryKey, entry);\n        return entry;\n    }","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResPackage.java#L252-L288","documentation":"AndrolibException thrown by ResPackage.addEntry(typeId, entryId, config, value) when an entry already exists for the (resource id, config) pair (after alias resolution). Each resource may hold one value per configuration; a second value for the same config — from a duplicated arsc entry chunk or repeated programmatic add — is rejected.","triggerScenarios":"A resources.arsc containing two RES_TABLE_ENTRY blocks for the same id and config; parsers visiting the same type chunk twice; programmatic builds calling addEntry twice for one (id, config).","commonSituations":"Obfuscators/collapsers that rewrite arsc entry lists; merged or binary-patched resource tables; replaying a parse over an already-populated ResPackage.","solutions":["When building programmatically, check mEntries via a get in try/catch (or track added ids) before addEntry.","Do not re-run a parser over an already-loaded ResPackage; create a fresh ResTable for each parse.","Validate suspicious files with aapt2 dump resources to confirm duplicates, then re-obtain the APK."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// When streaming entries, track seen (id, config) keys\nSet<Pair<ResId, ResConfig>> seen = new HashSet<>();\nPair<ResId, ResConfig> key = Pair.of(resId, config);\nif (!seen.add(key)) { /* duplicate chunk in arsc: report corruption */ }","typeGuard":null,"tryCatchPattern":"try {\n    pkg.addEntry(typeId, entryId, config, value);\n} catch (AndrolibException ex) {\n    // repeated entry chunk -> corrupt arsc; stop parsing this package\n}","preventionTips":["Parse each arsc into a fresh ResTable; never replay over a populated one","Dedupe (id, config) while generating arsc yourself","Validate merges with aapt2 before shipping"],"tags":["android","apktool","resource-table","duplicate","corruption"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}