Anuken/Mindustry · error · ModLoadException
A mod with the name '{baseName}' is already imported.
Error message
A mod with the name '{baseName}' is already imported. What it means
When importing a mod, if another mod with the same baseName already exists and cannot be overwritten (e.g. it has a Steam ID), loadMod throws ModLoadException. Non-Steam duplicates are silently overwritten; Steam ones must be removed via unsubscribe.
Source
Thrown at core/src/mindustry/mod/Mods.java:1133
Fi cacheDir = new Fi(Core.files.getCachePath()).child("mods");
Fi modCacheDir = cacheDir.child(other.file.nameWithoutExtension());
modCacheDir.deleteDirectory();
}
//close zip file
if(other.root instanceof ZipFi){
other.root.delete();
}
//delete the old mod directory
if(other.file.isDirectory()){
other.file.deleteDirectory();
}else{
other.file.delete();
}
//unload
mods.remove(other);
}else{
throw new ModLoadException("A mod with the name '" + baseName + "' is already imported.");
}
}
ClassLoader loader = null;
Mod mainMod;
Fi mainFile = zip;
if(android){
mainFile = mainFile.child("classes.dex");
}else{
String[] path = (mainClass.replace('.', '/') + ".class").split("/");
for(String str : path){
if(!str.isEmpty()){
mainFile = mainFile.child(str);
}
}
}
View on GitHub (pinned to f695ad7e60)
Solutions
- Unsubscribe the existing Steam mod first, then import.
- Rename your mod's 'name' field to a unique baseName.
- Remove the duplicate from the mods directory.
Example fix
// before: meta.json name "example" collides with subscribed Steam mod // after: change "name": "example" to "name": "example-dev"
Defensive patterns
Strategy: validation
Validate before calling
// Check for an existing same-name mod before importing.
String baseName = meta.name.toLowerCase(Locale.ROOT).replace(" ", "-");
LoadedMod existing = mods.getMods().find(m -> m.name.equals(baseName));
if(existing != null && existing.hasSteamID()) {
throw new ModLoadException("Conflict with Steam mod '" + baseName + "'; unsubscribe first.");
} Type guard
boolean nameIsFree(Mods mods, String name){
String base = name.toLowerCase(Locale.ROOT).replace(" ", "-");
return mods.getMods().noneMatch(m -> m.name.equals(base));
} Try / catch
try {
mods.importMod(file);
} catch(ModLoadException e) {
if(e.getMessage().contains("already imported")) { /* unsubscribe Steam dup or rename */ }
else throw e;
} Prevention
- Give mods unique 'name' values.
- Unsubscribe conflicting Steam Workshop items before local imports.
- Check installed mods before importing a dev copy.
When it happens
Trigger: Importing a local mod whose normalized name matches an already-imported Steam mod (hasSteamID() true).
Common situations: Re-importing a mod also installed from Steam; two mods sharing the same name field; development copy colliding with a subscribed Workshop item.
Related errors
- Invalid file: No mod.json found.
- This mod/plugin has loaded Mindustry dependencies from its o
- Two content objects defined with the same name: '{content.na
- Attribute definitions must be objects, e.g. {heat: 10}
- Unknown status effect: '
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/f54c6f9702a73134.
Report an issue: GitHub.