Konloch/bytecode-viewer · error · Exception

Unable to resolve class-filetype.

Error message

Unable to resolve class-filetype.

What it means

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.

Source

Thrown at src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/ProcyonDecompiler.java:99

            //initialize procyon
            DecompilerSettings settings = getDecompilerSettings();
            LuytenTypeLoader typeLoader = new LuytenTypeLoader();
            MetadataSystem metadataSystem = new MetadataSystem(typeLoader);
            DecompilationOptions decompilationOptions = new DecompilationOptions();
            StringWriter writer = new StringWriter();

            //lookup the class-file
            TypeReference type = metadataSystem.lookupType(tempInputClassFile.getCanonicalPath());

            //configure procyon
            decompilationOptions.setSettings(settings);
            decompilationOptions.setFullDecompilation(true);

            //parse class-file
            TypeDefinition resolvedType;

            if (type == null || ((resolvedType = type.resolve()) == null))
                throw new Exception("Unable to resolve class-filetype.");

            //decompile the class-file
            settings.getLanguage().decompileType(resolvedType, new PlainTextOutput(writer), decompilationOptions);

            //handle simulated errors
            if(Constants.DEV_FLAG_DECOMPILERS_SIMULATED_ERRORS)
                throw new RuntimeException(DEV_MODE_SIMULATED_ERROR.toString());

            //return the writer contents
            return EncodeUtils.unicodeToString(writer.toString());
        }
        catch (Throwable e)
        {
            exception = ExceptionUtils.exceptionToString(e);
        }
        finally
        {
            //delete all temporary files

View on GitHub (pinned to 31430e0033)

Solutions

  1. Verify the ClassNode contains valid bytecode (magic/version sane, classFile bytes non-empty) before invoking the decompiler.
  2. Decompile from the original source (file/jar entry) rather than a purely in-memory node when possible.
  3. Use a decompiler that supports the class's version, or recompile/re-convert the input.
  4. Catch this exception and surface a friendly 'cannot decompile this class' result in the UI.

Example fix

// before
String s = decomp(node);
// after
String s;
try { s = decomp(node); }
catch (Exception e) { s = "// failed to decompile: " + e.getMessage(); }
Defensive patterns

Strategy: try-catch

Validate before calling

// validate the ClassNode has resolvable backing bytes first
if (node == null || node.b == null || node.b.length < 8)
    throw new IllegalArgumentException("ClassNode has no loadable bytecode");

Type guard

boolean isDecompilable(org.objectweb.asm.tree.ClassNode node) {
    return node != null && node.b != null && node.b.length > 8
        && node.b[0]==(byte)0xCA && node.b[1]==(byte)0xFE && node.b[2]==(byte)0xBA && node.b[3]==(byte)0xBE;
}

Try / catch

try {
    String src = procyonDecompiler.decompileClassNode(node, ...);
} catch (Exception e) {
    if (e.getMessage() != null && e.getMessage().contains("Unable to resolve class-filetype")) {
        src = "// cannot decompile: type not resolvable";
    } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of Konloch/bytecode-viewer@31430e0033 (2026-09-05). Data as JSON: /api/errors/40b93e66a821b8eb. Report an issue: GitHub.