Konloch/bytecode-viewer · error · RuntimeException
Multiple plugin subclasses.
Error message
Multiple plugin subclasses.
What it means
CompiledJavaPluginLaunchStrategy.run loads classes from the compiled plugin bundle and scans ClassNodes for exactly one subclass of Plugin (PLUGIN_CLASS_NAME). If two or more classes extend Plugin it cannot pick which to instantiate and throws RuntimeException("Multiple plugin subclasses.").
Source
Thrown at src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/CompiledJavaPluginLaunchStrategy.java:61
private static final String PLUGIN_CLASS_NAME = Plugin.class.getCanonicalName().replace(".", "/");
private final Set<LoadedPluginData> loaded = new HashSet<>();
@Override
public Plugin run(File file) throws Throwable
{
Set<LoadedNodeData> set = loadData(file);
LoadedNodeData pdata = null;
for (LoadedNodeData d : set)
{
ClassNode cn = d.node;
if (Objects.equals(cn.superName, PLUGIN_CLASS_NAME))
{
if (pdata == null)
pdata = d;
else
throw new RuntimeException("Multiple plugin subclasses.");
}
}
LoadingClassLoader cl = new LoadingClassLoader(pdata, set);
Plugin p = cl.pluginKlass.getDeclaredConstructor().newInstance();
LoadedPluginData npdata = new LoadedPluginData(pdata, cl, p);
loaded.add(npdata);
return p;
}
public Set<LoadedPluginData> getLoaded()
{
return loaded;
}
private static Set<LoadedNodeData> loadData(File jarFile) throws Throwable
{View on GitHub (pinned to 31430e0033)
Solutions
- Ensure exactly one class extends Plugin in the plugin bundle; remove or split the others.
- Clean the build output and recompile so stale classes are not bundled.
- Split each plugin class into its own plugin file and run them separately.
- Convert extra classes to not extend Plugin (use plain helpers).
Example fix
// before
class MyPlugin extends Plugin { ... }
class MyOtherPlugin extends Plugin { ... } // bundled together -> throws
// after
class MyPlugin extends Plugin { ... }
class MyHelper { ... } // only one Plugin subclass in the bundle Defensive patterns
Strategy: validation
Try / catch
try {
PluginManager.runPlugin(compiledPluginFile);
} catch (RuntimeException e) {
if ("Multiple plugin subclasses.".equals(e.getMessage()))
showError("Bundle contains more than one Plugin subclass; split or clean the plugin.");
else
throw e;
} Prevention
- Keep one Plugin subclass per plugin bundle.
- Clean build output before recompiling to avoid stale classes.
- Make helper classes plain (do not extend Plugin).
- Inspect the bundled classes (e.g. in Bytecode Viewer) before distributing.
When it happens
Trigger: Running a compiled Java plugin whose class set contains two or more classes whose superName equals PLUGIN_CLASS_NAME — e.g. several plugin classes bundled into one plugin file.
Common situations: Bundling multiple plugins into a single compiled plugin archive; leftover old plugin classes not removed from the build; an inner/helper class accidentally extending Plugin; recompiling into the same output directory merging old classes.
Related errors
- Cannot find Groovy script engine! Please contact Konloch.
- Invalid internal class name
- No launch strategy for extension %s (%s)
- Cannot find Javascript script engine! Please contact Konloch
- Cannot find Jython script engine! Please contact Konloch.
AI-assisted analysis of Konloch/bytecode-viewer@31430e0033 (2026-09-05).
Data as JSON: /api/errors/7ce9e42d835981e4.
Report an issue: GitHub.