{"record":{"id":"5fbdc7441e2ea469","repo":"skylot/jadx","slug":"usage-info-collection-failed-with-error-at-ins","errorCode":null,"errorMessage":"Usage info collection failed with error: {} at insn: {}","messagePattern":"Usage info collection failed with error: (.+?) at insn: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"warning","filePath":"jadx-core/src/main/java/jadx/core/dex/visitors/usage/UsageInfoVisitor.java","lineNumber":132,"sourceCode":"\t\t} catch (Exception e) {\n\t\t\tmth.addError(\"Dependency scan failed\", e);\n\t\t}\n\t}\n\n\tprivate static void processInstructions(MethodNode mth, UsageInfo usageInfo) {\n\t\tif (mth.isNoCode()) {\n\t\t\treturn;\n\t\t}\n\t\tICodeReader codeReader = mth.getCodeReader();\n\t\tif (codeReader == null) {\n\t\t\treturn;\n\t\t}\n\t\tRootNode root = mth.root();\n\t\tcodeReader.visitInstructions(insnData -> {\n\t\t\ttry {\n\t\t\t\tprocessInsn(root, mth, insnData, usageInfo);\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new JadxRuntimeException(\n\t\t\t\t\t\t\"Usage info collection failed with error: \" + e.getMessage() + \" at insn: \" + insnData, e);\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate static void processInsn(RootNode root, MethodNode mth, InsnData insnData, UsageInfo usageInfo) {\n\t\tif (insnData.getOpcode() == Opcode.UNKNOWN) {\n\t\t\treturn;\n\t\t}\n\t\tswitch (insnData.getIndexType()) {\n\t\t\tcase TYPE_REF:\n\t\t\t\tinsnData.decode();\n\t\t\t\tArgType usedType = ArgType.parse(insnData.getIndexAsType());\n\t\t\t\tusageInfo.clsUse(mth, usedType);\n\t\t\t\tbreak;\n\n\t\t\tcase FIELD_REF:\n\t\t\t\tinsnData.decode();","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/dex/visitors/usage/UsageInfoVisitor.java#L114-L150","documentation":"Thrown (and then re-caught one level up in UsageInfoVisitor.processMethod, where it becomes mth.addError) when per-instruction usage scanning raises any exception - typically a malformed instruction, an unresolvable type/field/method reference, or a NPE in processInsn. Because processMethod wraps processInstructions in its own try/catch that records the failure as a method-level error, the practical effect is a warning comment, not a fatal abort.","triggerScenarios":"Decompiling a class where one method's bytecode contains an instruction whose index/type/method-handle decoding fails (e.g. an unknown opcode that is not UNKNOWN, a malformed type descriptor, or a field/method ref that points outside the DEX). The lambda inside codeReader.visitInstructions catches Exception and rethrows as JadxRuntimeException.","commonSituations":"Packed/protected apps, DEX edited by hand, multi-dex merges that lost string/type tables, or newer opcodes not yet supported by the jadx version in use. Usually scoped to one method; the rest of the class still decompiles.","solutions":["Update jadx - new opcodes and reference formats are added each release.","Inspect the reported insn offset in the failing method to identify the unsupported/malformed instruction and file an issue.","No code change needed if you already use jadx normally; the error is recorded as a method warning and the run continues.","When embedding jadx, surface mth.getErrors()/class warnings to the user instead of treating this throw as fatal."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// jadx already converts this to mth.addError() upstream;\n// surface those errors instead of catching the throw:\nfor (JadxError err : cls.getErrors()) {\n    if (err.msg().contains(\"Usage info collection failed\")) { ... }\n}","preventionTips":["Do not treat this throw as fatal - jadx records it as a method warning.","Read mth.getErrors()/class warn comments to see which instruction offset failed.","Update jadx for newer opcode/reference support."],"tags":["decompiler","usage","instructions","malformed-bytecode","non-fatal"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}