{"record":{"id":"1411eff3b6e8b71b","repo":"skylot/jadx","slug":"unexpected-argument-type-in-lambda-call","errorCode":null,"errorMessage":"Unexpected argument type in lambda call: ","messagePattern":"Unexpected argument type in lambda call: ","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/codegen/InsnGen.java","lineNumber":1069,"sourceCode":"\t\t\t\tCodeVar argCodeVar = callArgs.get(i).getSVar().getCodeVar();\n\t\t\t\tdefVar(code, argCodeVar);\n\t\t\t}\n\t\t\tif (callArgsCount - startArg > 1) {\n\t\t\t\tcode.add(')');\n\t\t\t}\n\t\t}\n\t\t// force set external arg names into call method args\n\t\tint extArgsCount = customNode.getArgsCount();\n\t\tint startArg = customNode.getHandleType() == MethodHandleType.INVOKE_STATIC ? 0 : 1; // skip 'this' arg\n\t\tint callArg = 0;\n\t\tfor (int i = startArg; i < extArgsCount; i++) {\n\t\t\tInsnArg arg = customNode.getArg(i);\n\t\t\tif (arg.isRegister()) {\n\t\t\t\tRegisterArg extArg = (RegisterArg) arg;\n\t\t\t\tRegisterArg callRegArg = callArgs.get(callArg++);\n\t\t\t\tcallRegArg.getSVar().setCodeVar(extArg.getSVar().getCodeVar());\n\t\t\t} else {\n\t\t\t\tthrow new JadxRuntimeException(\"Unexpected argument type in lambda call: \" + arg.getClass().getSimpleName());\n\t\t\t}\n\t\t}\n\t\tcode.add(\" -> {\");\n\t\tcode.incIndent();\n\t\tcallMthGen.addInstructions(code);\n\n\t\tcode.decIndent();\n\t\tcode.startLine('}');\n\t}\n\n\tprivate void callSuper(ICodeWriter code, MethodInfo callMth) {\n\t\tClassInfo superCallCls = getClassForSuperCall(callMth);\n\t\tif (superCallCls == null) {\n\t\t\t// unknown class, add comment to keep that info\n\t\t\tcode.add(\"super/*\").add(callMth.getDeclClass().getFullName()).add(\"*/\");\n\t\t\treturn;\n\t\t}\n\t\tClassInfo curClass = mth.getParentClass().getClassInfo();","sourceCodeStart":1051,"sourceCodeEnd":1087,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/codegen/InsnGen.java#L1051-L1087","documentation":"Thrown by InsnGen.makeInlinedLambdaMethod() when an invoke-custom node argument is not a RegisterArg. The method expects all arguments to be register-typed so it can wire up code variables between the lambda call site and the implementation method. A non-register arg (e.g., a literal or instruction wrapper) indicates an inconsistency in how the invoke-custom node was constructed during earlier processing.","triggerScenarios":"An InvokeCustomNode whose capture arguments are not all RegisterArg instances after lambda processing. This can happen when an earlier pass fails to convert invoke-custom arguments to registers, or when the invoke-custom has an unusual structure (e.g., bytecode-level constant captures).","commonSituations":"Complex lambda capture patterns where some arguments are constants or inline expressions rather than variables. Obfuscated code modifying invoke-custom argument structures. Internal jadx bugs in InvokeCustomBuilder or related processing.","solutions":["Report the class and invoke-custom instruction to jadx.","Update to the latest jadx version — lambda processing is frequently improved.","Use fallback decompilation mode to bypass lambda inlining."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Guard before lambda inlining: verify all custom node args are registers\nprivate static boolean allArgsAreRegisters(InvokeCustomNode node) {\n    for (int i = 0; i < node.getArgsCount(); i++) {\n        if (!node.getArg(i).isRegister()) {\n            return false;\n        }\n    }\n    return true;\n}","tryCatchPattern":"try {\n    codeGen.makeCode(cls);\n} catch (JadxRuntimeException e) {\n    if (e.getMessage().startsWith(\"Unexpected argument type in lambda call\")) {\n        logger.error(\"Non-register arg in lambda call — internal jadx bug. \" +\n            \"Retrying with fallback mode.\", e);\n        args.setDecompilationMode(DecompilationMode.FALLBACK);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Report the class and invoke-custom instruction to jadx — this is an internal processing bug.","Use fallback decompilation mode to bypass lambda inlining.","Update jadx — lambda argument processing is actively improved."],"tags":["codegen","invoke-custom","lambda","arg","internal-bug"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}