{"record":{"id":"4ca0d1062311e551","repo":"skylot/jadx","slug":"failed-to-process-method-to-visitor","errorCode":null,"errorMessage":"Failed to process method to visitor: ","messagePattern":"Failed to process method to visitor: ","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/ProcessClass.java","lineNumber":243,"sourceCode":"\t\tif (foundPass == null) {\n\t\t\treturn false;\n\t\t}\n\t\treturn processMethodToVisitor(mth, foundPass);\n\t}\n\n\tpublic boolean processMethodToVisitor(MethodNode mth, IDexTreeVisitor lastPassToProcess) {\n\t\tsynchronized (mth.getTopParentClass().getClassInfo()) {\n\t\t\ttry {\n\t\t\t\tmth.unload();\n\t\t\t\tmth.load();\n\t\t\t\tfor (IDexTreeVisitor pass : passes) {\n\t\t\t\t\tDepthTraversal.visit(pass, mth);\n\t\t\t\t\tif (pass == lastPassToProcess) {\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (Exception e) {\n\t\t\t\tthrow new JadxRuntimeException(\"Failed to process method to visitor: \" + lastPassToProcess, e);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t// TODO: make passes list private and not visible\n\tpublic List<IDexTreeVisitor> getPasses() {\n\t\treturn passes;\n\t}\n}\n","sourceCodeStart":225,"sourceCodeEnd":254,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/ProcessClass.java#L225-L254","documentation":"Thrown by ProcessClass.processMethodToVisitor when an exception occurs while running visitor passes on a single method up to a specified pass. The method unloads and reloads the method, then iterates through the passes list calling DepthTraversal.visit until lastPassToProcess is reached. Any exception during this iteration is wrapped in a JadxRuntimeException naming the target visitor.","triggerScenarios":"Calling processMethodToVisitor(mth, lastPassToProcess) where a visitor pass throws during DepthTraversal.visit. This API is used for partial reprocessing of a method (e.g., interactive decompiler workflows that re-run passes after user edits). The exception occurs within a synchronized block on the top-parent class's ClassInfo, so it also signals a lock-held failure.","commonSituations":"Interactive or programmatic decompiler sessions that selectively re-run passes on individual methods. Reprocessing a method whose state was manually modified between passes. Obfuscated method bodies that trigger visitor-specific bugs (e.g., type inference, SSATransform).","solutions":["Examine getCause() to identify the failing visitor pass class and the root exception.","Ensure the method node is in a valid state (loaded, not partially unloaded) before calling processMethodToVisitor.","Catch JadxRuntimeException around the call and fall back to full class reprocessing (forceProcess + generateCode).","Report reproducible single-method failures with the method signature and full cause to jadx maintainers."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    boolean ok = processClass.processMethodToVisitor(mth, lastPass);\n    if (!ok) {\n        LOG.warn(\"Pass {} not found for method {}\", lastPass, mth);\n    }\n} catch (JadxRuntimeException e) {\n    LOG.warn(\"Method pass {} failed for {}: {}\", lastPass, mth, e.getCause().getMessage());\n    // fall back to full class reprocessing\n}","preventionTips":["Ensure the method node is in a loaded, valid state before calling processMethodToVisitor.","Fall back to full class reprocessing (forceProcess + generateCode) if method-level reprocessing fails.","Log the cause exception to identify the specific visitor pass that failed."],"tags":["decompiler","method-processing","visitor","core"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}