{"record":{"id":"b43cd5b75ce1465a","repo":"iBotPeaches/Apktool","slug":"type-pkgid-0x-02x-typeid-0x-02x-config-s","errorCode":null,"errorMessage":"type: pkgId=0x%02x, typeId=0x%02x, config=%s","messagePattern":"type: pkgId=0x%02x, typeId=0x%02x, config=(.+?)","errorType":"exception","errorClass":"UndefinedResObjectException","httpStatus":null,"severity":"error","filePath":"brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResPackage.java","lineNumber":126,"sourceCode":"\n    public boolean hasType(int typeId) {\n        return hasType(typeId, ResConfig.DEFAULT);\n    }\n\n    public boolean hasType(int typeId, ResConfig config) {\n        Pair<Integer, ResConfig> typeKey = Pair.of(typeId, config);\n        return mTypes.containsKey(typeKey);\n    }\n\n    public ResType getType(int typeId) throws UndefinedResObjectException {\n        return getType(typeId, ResConfig.DEFAULT);\n    }\n\n    public ResType getType(int typeId, ResConfig config) throws UndefinedResObjectException {\n        Pair<Integer, ResConfig> typeKey = Pair.of(typeId, config);\n        ResType type = mTypes.get(typeKey);\n        if (type == null) {\n            throw new UndefinedResObjectException(\n                String.format(\"type: pkgId=0x%02x, typeId=0x%02x, config=%s\", getId(), typeId, config));\n        }\n        return type;\n    }\n\n    public ResType addType(int typeId) throws UndefinedResObjectException {\n        return addType(typeId, ResConfig.DEFAULT);\n    }\n\n    public ResType addType(int typeId, ResConfig config) throws UndefinedResObjectException {\n        Pair<Integer, ResConfig> typeKey = Pair.of(typeId, config);\n        ResType type = mTypes.get(typeKey);\n        if (type != null) {\n            // We can safely skip adding existing types.\n            return type;\n        }\n\n        ResTypeSpec typeSpec = getTypeSpec(typeId);","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/iBotPeaches/Apktool/blob/79b63384d7d7e22917e6ea8b453272da7012515b/brut.apktool/apktool-lib/src/main/java/brut/androlib/res/table/ResPackage.java#L108-L144","documentation":"UndefinedResObjectException thrown by ResPackage.getType(typeId, config) when no ResType exists for the (typeId, config) pair. ResType objects represent a type in one specific configuration (e.g. drawable for en-us); the error means that type/config combination was never created, most commonly because the type has no entry under the requested (often default) configuration.","triggerScenarios":"Calling getType(typeId) which defaults to ResConfig.DEFAULT when the type only has non-default configs; looking up a config that exists for another type but not this one; programmatic construction calling get before addType.","commonSituations":"Resource tables where a string/drawable exists only for specific locales or densities; code assuming every type has a default-config entry; handling localized apps and app bundles with per-density splits.","solutions":["Use hasType(typeId, config) before getType(typeId, config).","If you need any config, iterate the available configs for the type instead of assuming ResConfig.DEFAULT exists.","When constructing tables, ensure addType(typeId, config) happens before any get for that pair."],"exampleFix":"// before\nResType type = pkg.getType(typeId); // implies ResConfig.DEFAULT\n\n// after\nResConfig config = pkg.hasType(typeId, ResConfig.DEFAULT) ? ResConfig.DEFAULT : firstAvailableConfig(pkg, typeId);\nResType type = pkg.getType(typeId, config);","handlingStrategy":"type-guard","validationCode":"ResConfig config = pkg.hasType(typeId, ResConfig.DEFAULT)\n    ? ResConfig.DEFAULT\n    : pickExistingConfig(pkg, typeId);","typeGuard":"boolean hasTypeForConfig(ResPackage pkg, int typeId, ResConfig config) {\n    return pkg.hasType(typeId, config);\n}","tryCatchPattern":"try {\n    ResType type = pkg.getType(typeId, config);\n} catch (UndefinedResObjectException ex) {\n    // no values for this type under requested config; try other configs or skip\n}","preventionTips":["Never assume the default config exists for every type","Enumerate available configs when handling localized/density resources","Load all splits of an app bundle for full config coverage"],"tags":["android","apktool","resource-table","undefined-object","configurations"],"backgroundTag":null,"analyzedSha":"79b63384d7d7e22917e6ea8b453272da7012515b","analyzedAt":"2026-08-14T10:43:28.812Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}