{"record":{"id":"5a451dbf71d5f565","repo":"skylot/jadx","slug":"type-update-failed-for-variable-new-type","errorCode":null,"errorMessage":"Type update failed for variable: {}, new type: {}","messagePattern":"Type update failed for variable: (.+?), new type: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeUpdate.java","lineNumber":109,"sourceCode":"\t\t\t\tresult = runUpdate(updateInfo);\n\t\t\t}\n\t\t\tif (result == REJECT) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tif (updateInfo.isEmpty()) {\n\t\t\t\treturn SAME;\n\t\t\t}\n\t\t\tif (Consts.DEBUG_TYPE_INFERENCE) {\n\t\t\t\tLOG.debug(\"Applying type {} to {}:\", candidateType, ssaVar.toShortString());\n\t\t\t\tupdateInfo.getSortedUpdates().forEach(upd -> LOG.debug(\"  {} -> {} in {}\",\n\t\t\t\t\t\tupd.getType(), upd.getArg().toShortString(), upd.getArg().getParentInsn()));\n\t\t\t}\n\t\t\tupdateInfo.applyUpdates();\n\t\t\treturn CHANGED;\n\t\t} catch (JadxOverflowException e) {\n\t\t\tthrow e;\n\t\t} catch (Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Type update failed for variable: \" + ssaVar + \", new type: \" + candidateType, e);\n\t\t}\n\t}\n\n\tprivate TypeUpdateResult runUpdate(TypeUpdateInfo updateInfo) {\n\t\tTypeUpdateResult result = REJECT;\n\t\twhile (true) {\n\t\t\tTypeUpdateRequest request = updateInfo.pollNextRequest();\n\t\t\tif (request == null) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t\tInsnArg updateArg = request.getArg();\n\t\t\tArgType updateType = request.getCandidateType();\n\t\t\tTypeUpdateResult newResult;\n\t\t\tif (request.isDirect()) {\n\t\t\t\tnewResult = requestUpdate(updateInfo, updateArg, updateType);\n\t\t\t} else {\n\t\t\t\tnewResult = updateTypeForArg(updateInfo, updateArg, updateType);\n\t\t\t}","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/dex/visitors/typeinference/TypeUpdate.java#L91-L127","documentation":"Thrown by TypeUpdate.apply to wrap any non-overflow exception raised while propagating a candidate ArgType across an SSA variable's uses. JadxOverflowException (the 185 limit) is re-thrown unchanged; everything else (NPE, illegal state, type-system inconsistency) is wrapped with the SSA var and the candidate type for diagnosis. It indicates a bug in the type system for that method/type combination.","triggerScenarios":"Type inference is asked to apply a candidate type to an SSA variable, and during runUpdate/updateTypeForArg some instruction argument rejects or mishandles that type (e.g. a type that breaks a cast target, an arg whose parent insn is null). The message gives the SSA var and the candidate ArgType that triggered the failure.","commonSituations":"Observed on methods with unusual generics, array/generic mixes, or reflectively generated bytecode. Like 185 it is concentrated in type-inference-heavy methods, but unlike 185 it is not a tunable limit - it is an internal exception.","solutions":["Upgrade jadx; type-inference robustness is the single most active area of fixes.","Report the input plus the SSA var / candidate type from the message.","Catch JadxRuntimeException around per-method decompilation so the batch continues.","As a workaround you can try disabling debug-info application (args.setUseDebugInfo(...)) which removes one source of candidate types."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    typeUpdate.apply(mth, ssaVar, candidateType);\n} catch (JadxRuntimeException e) {\n    if (e.getMessage().startsWith(\"Type update failed for variable\")) {\n        mth.addWarnComment(\"type update failed for \" + ssaVar + \" as \" + candidateType);\n    } else { throw e; }\n}","preventionTips":["Catch JadxRuntimeException around type-inference calls so one var/type fails soft.","Update jadx; type-system fixes are the most active area.","Optionally disable debug-info application (args.setUseDebugInfo(false)) to drop one source of candidate types."],"tags":["decompiler","type-inference","ssa","internal-bug","exception-wrap"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}