{"record":{"id":"40b93e66a821b8eb","repo":"Konloch/bytecode-viewer","slug":"unable-to-resolve-class-filetype","errorCode":null,"errorMessage":"Unable to resolve class-filetype.","messagePattern":"Unable to resolve class-filetype\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/ProcyonDecompiler.java","lineNumber":99,"sourceCode":"            //initialize procyon\n            DecompilerSettings settings = getDecompilerSettings();\n            LuytenTypeLoader typeLoader = new LuytenTypeLoader();\n            MetadataSystem metadataSystem = new MetadataSystem(typeLoader);\n            DecompilationOptions decompilationOptions = new DecompilationOptions();\n            StringWriter writer = new StringWriter();\n\n            //lookup the class-file\n            TypeReference type = metadataSystem.lookupType(tempInputClassFile.getCanonicalPath());\n\n            //configure procyon\n            decompilationOptions.setSettings(settings);\n            decompilationOptions.setFullDecompilation(true);\n\n            //parse class-file\n            TypeDefinition resolvedType;\n\n            if (type == null || ((resolvedType = type.resolve()) == null))\n                throw new Exception(\"Unable to resolve class-filetype.\");\n\n            //decompile the class-file\n            settings.getLanguage().decompileType(resolvedType, new PlainTextOutput(writer), decompilationOptions);\n\n            //handle simulated errors\n            if(Constants.DEV_FLAG_DECOMPILERS_SIMULATED_ERRORS)\n                throw new RuntimeException(DEV_MODE_SIMULATED_ERROR.toString());\n\n            //return the writer contents\n            return EncodeUtils.unicodeToString(writer.toString());\n        }\n        catch (Throwable e)\n        {\n            exception = ExceptionUtils.exceptionToString(e);\n        }\n        finally\n        {\n            //delete all temporary files","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/Konloch/bytecode-viewer/blob/31430e0033fa220db566b5ef461256727ff6793b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/ProcyonDecompiler.java#L81-L117","documentation":"ProcyonDecompiler.decompileClassNode throws this when the in-memory ClassNode (converted to a Procyon TypeReference) is null or its type cannot be resolved to a TypeDefinition. Procyon must load and resolve the class's type metadata before decompilation; an unresolvable type means the bytecode representation is absent or inconsistent.","triggerScenarios":"Decompiling a synthetic/dynamically generated ClassNode that has no backing resource Procyon's MetadataSystem can resolve; passing a Node whose bytes are empty or corrupt; input class from a newer class-file version Procyon's reader rejects; lookup of an internalName that does not correspond to any resource on the type provider.","commonSituations":"Decompiling classes injected at runtime (with no underlying file), obfuscated class names that don't map to files, class files from JDK versions newer than the bundled Procyon, or damaged jar entries.","solutions":["Verify the ClassNode contains valid bytecode (magic/version sane, classFile bytes non-empty) before invoking the decompiler.","Decompile from the original source (file/jar entry) rather than a purely in-memory node when possible.","Use a decompiler that supports the class's version, or recompile/re-convert the input.","Catch this exception and surface a friendly 'cannot decompile this class' result in the UI."],"exampleFix":"// before\nString s = decomp(node);\n// after\nString s;\ntry { s = decomp(node); }\ncatch (Exception e) { s = \"// failed to decompile: \" + e.getMessage(); }","handlingStrategy":"try-catch","validationCode":"// validate the ClassNode has resolvable backing bytes first\nif (node == null || node.b == null || node.b.length < 8)\n    throw new IllegalArgumentException(\"ClassNode has no loadable bytecode\");","typeGuard":"boolean isDecompilable(org.objectweb.asm.tree.ClassNode node) {\n    return node != null && node.b != null && node.b.length > 8\n        && node.b[0]==(byte)0xCA && node.b[1]==(byte)0xFE && node.b[2]==(byte)0xBA && node.b[3]==(byte)0xBE;\n}","tryCatchPattern":"try {\n    String src = procyonDecompiler.decompileClassNode(node, ...);\n} catch (Exception e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Unable to resolve class-filetype\")) {\n        src = \"// cannot decompile: type not resolvable\";\n    } else throw e;\n}","preventionTips":["Prefer decompiling from real jar/file resources over purely synthetic nodes","Check class-file version against the Procyon version in use","Handle obfuscated/synthetic classes with a fallback decompiler","Return per-class failure messages instead of failing the whole batch"],"tags":["java","decompiler","procyon","class-resolution"],"backgroundTag":"type-resolution-failed","analyzedSha":"31430e0033fa220db566b5ef461256727ff6793b","analyzedAt":"2026-09-05T18:22:22.725Z","contentChangedAt":"2026-09-05T18:22:22.725Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}