{"record":{"id":"b3ea439ee814627d","repo":"skylot/jadx","slug":"failed-to-generate-code-for-class-cls-getfullna","errorCode":null,"errorMessage":"Failed to generate code for class: ${cls.getFullName()}","messagePattern":"Failed to generate code for class: (.+?)","errorType":"exception","errorClass":"JadxRuntimeException","httpStatus":null,"severity":"error","filePath":"jadx-core/src/main/java/jadx/core/ProcessClass.java","lineNumber":133,"sourceCode":"\t\t\t\tprocess(cls, false);\n\t\t\t\treturn NOT_GENERATED;\n\t\t\t}\n\t\t\tfor (ClassNode depCls : cls.getDependencies()) {\n\t\t\t\tprocess(depCls, false);\n\t\t\t}\n\t\t\tif (!cls.getCodegenDeps().isEmpty()) {\n\t\t\t\tprocess(cls, false);\n\t\t\t\tfor (ClassNode codegenDep : cls.getCodegenDeps()) {\n\t\t\t\t\tprocess(codegenDep, false);\n\t\t\t\t}\n\t\t\t}\n\t\t\tICodeInfo code = process(cls, true);\n\t\t\tif (code == null) {\n\t\t\t\tthrow new JadxRuntimeException(\"Codegen failed\");\n\t\t\t}\n\t\t\treturn code;\n\t\t} catch (StackOverflowError | Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Failed to generate code for class: \" + cls.getFullName(), e);\n\t\t}\n\t}\n\n\t/**\n\t * Load and process class without its deps\n\t */\n\tpublic void forceProcess(ClassNode cls) {\n\t\tClassNode topParentClass = cls.getTopParentClass();\n\t\tif (topParentClass != cls) {\n\t\t\tforceProcess(topParentClass);\n\t\t\treturn;\n\t\t}\n\t\ttry {\n\t\t\tprocess(cls, false);\n\t\t} catch (StackOverflowError | Exception e) {\n\t\t\tthrow new JadxRuntimeException(\"Failed to process class: \" + cls.getFullName(), e);\n\t\t}\n\t}","sourceCodeStart":115,"sourceCodeEnd":151,"githubUrl":"https://github.com/skylot/jadx/blob/e738a26571d02919f01df40de93bc9a44dee4e18/jadx-core/src/main/java/jadx/core/ProcessClass.java#L115-L151","documentation":"Thrown by ProcessClass.generateCode when any exception or StackOverflowError occurs during full code generation for a class (including processing its dependencies and codegen dependencies). Jadx wraps the root cause in a JadxRuntimeException so callers get a uniform failure type with the fully-qualified class name. The inner cause is typically a decompiler bug, malformed bytecode, or recursive type reference causing StackOverflowError.","triggerScenarios":"Calling ProcessClass.generateCode(cls) on a ClassNode whose decompilation triggers an exception in any visitor pass or in CodeGen. The try block covers dependency processing (getDependencies, getCodegenDeps), the main process(cls, true) call, and the null-code check. The most common proximate cause is a StackOverflowError from deeply nested or self-referential type structures, or an NPE in a visitor pass.","commonSituations":"Decompiling obfuscated or malformed APKs/JARs with unusual bytecode patterns. Processing classes with circular dependencies or very deep generic type hierarchies. Running jadx on an input built with an unsupported or experimental bytecode version. This is the single most common error end-users of jadx-cli encounter on difficult inputs.","solutions":["Examine the cause (getCause()) in the stack trace to identify the failing pass or visitor — the message alone only names the class.","Try a different DecompilationMode (e.g., FALLBACK or SIMPLIFY) via forceGenerateCodeForMode to get partial output.","Report the class and full stack trace to the jadx issue tracker if it appears to be a decompiler bug.","Increase the JVM thread stack size (-Xss4m or higher) if StackOverflowError is the root cause, especially for deep type hierarchies."],"exampleFix":"// before\nICodeInfo code = processClass.generateCode(cls);\n\n// after: wrap and fall back to a simpler mode\nICodeInfo code;\ntry {\n    code = processClass.generateCode(cls);\n} catch (JadxRuntimeException e) {\n    LOG.warn(\"Codegen failed for {}, trying fallback mode\", cls.getFullName(), e);\n    code = processClass.forceGenerateCodeForMode(cls, DecompilationMode.FALLBACK);\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"ICodeInfo code;\ntry {\n    code = processClass.generateCode(cls);\n} catch (JadxRuntimeException e) {\n    LOG.warn(\"Failed to generate code for {}: {}\", cls.getFullName(), e.getCause().getMessage());\n    code = processClass.forceGenerateCodeForMode(cls, DecompilationMode.FALLBACK);\n}","preventionTips":["Increase JVM stack size (-Xss4m) to mitigate StackOverflowError on deep type hierarchies.","Batch-process classes in a loop with individual try-catch so one failure does not abort the whole decompilation.","Use DecompilationMode.FALLBACK for classes that fail in the default mode to get at least partial output.","Report reproducible failures with the class name and cause stack trace to jadx maintainers."],"tags":["decompiler","codegen","core","class-processing"],"backgroundTag":null,"analyzedSha":"e738a26571d02919f01df40de93bc9a44dee4e18","analyzedAt":"2026-08-14T00:10:24.238Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}