{"record":{"id":"8152e8dab3948b7b","repo":"skylot/jadx","slug":"failed-to-init-res-container-factory-rescontain","errorCode":null,"errorMessage":"Failed to init res container factory: ${resContainerFactory}","messagePattern":"Failed to init res container factory: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/api/ResourcesLoader.java","lineNumber":76,"sourceCode":"\t\tfor (File file : inputFiles) {\n\t\t\tloadFile(list, file);\n\t\t}\n\t\treturn list;\n\t}\n\n\tprivate void init(RootNode root) {\n\t\tfor (IResTableParserProvider resTableParserProvider : resTableParserProviders) {\n\t\t\ttry {\n\t\t\t\tresTableParserProvider.init(root);\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new JadxRuntimeException(\"Failed to init res table provider: \" + resTableParserProvider);\n\t\t\t}\n\t\t}\n\t\tfor (IResContainerFactory resContainerFactory : resContainerFactories) {\n\t\t\ttry {\n\t\t\t\tresContainerFactory.init(root);\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new JadxRuntimeException(\"Failed to init res container factory: \" + resContainerFactory);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic interface ResourceDecoder<T> {\n\t\tT decode(long size, InputStream is) throws IOException;\n\t}\n\n\t@Override\n\tpublic void addResContainerFactory(IResContainerFactory resContainerFactory) {\n\t\tresContainerFactories.add(resContainerFactory);\n\t}\n\n\t@Override\n\tpublic void addResTableParserProvider(IResTableParserProvider resTableParserProvider) {\n\t\tresTableParserProviders.add(resTableParserProvider);\n\t}\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/api/ResourcesLoader.java#L58-L94","documentation":"Thrown during ResourcesLoader.init() when an IResContainerFactory's init(root) throws. Container factories build resource containers (e.g., for nested archives or special resource types) and are initialized once against the RootNode alongside the table providers. A failure aborts resource loading with a JadxRuntimeException naming the factory via toString(), chaining the cause.","triggerScenarios":"Triggering resource loading (jadx.getResources()) with a registered IResContainerFactory whose init(root) raises an exception during the init loop.","commonSituations":"A custom IResContainerFactory plugin that throws on init (missing config, incompatible API); a version mismatch between the factory and jadx-core; a factory that depends on an external file/path that is absent; a classpath conflict loading the factory.","solutions":["Inspect getCause() and the factory name in the message to identify the failing factory.","Remove or update the offending IResContainerFactory from the registered factories.","Align the factory's version with the jadx-core API version.","Make a custom factory's init defensive: catch internally and degrade gracefully instead of throwing."],"exampleFix":"// before\n@Override\npublic void init(RootNode root) {\n    this.cache = buildContainerCache(root); // throws\n}\n\n// after\n@Override\npublic void init(RootNode root) {\n    try {\n        this.cache = buildContainerCache(root);\n    } catch (Exception e) {\n        LOG.error(\"Container factory init failed, factory disabled\", e);\n        this.cache = Collections.emptyMap();\n    }\n}","handlingStrategy":"try-catch","validationCode":"// Wrap each factory's init during your own setup so one bad factory\n// does not abort all resource loading.\nfor (IResContainerFactory f : factories) {\n    try { f.init(root); } catch (Exception e) {\n        LOG.warn(\"Disabling failing factory {}: {}\", f, e);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    jadx.getResources();\n} catch (JadxRuntimeException e) {\n    if (e.getMessage().startsWith(\"Failed to init res container factory\")) {\n        LOG.error(\"Resource container factory failed: {}\", e.getMessage());\n        // remove the named factory and retry\n    } else throw e;\n}","preventionTips":["Ensure factory plugin versions match jadx-core.","Make custom factories' init() defensive rather than throwing.","Register factories one at a time to identify the culprit."],"tags":["resources","plugins","initialization","android"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}