Anuken/Mindustry · error · RuntimeException
Unknown mesh type: ${tname}
Error message
Unknown mesh type: ${tname} What it means
parseMesh() switches on the mesh config's "type" string to instantiate the right mesh class (SunMesh, HexSkyMesh, MultiMesh, MatMesh, etc.). An unrecognized type name hits the default branch and throws, since the mesh cannot be constructed.
Source
Thrown at core/src/mindustry/mod/ContentParser.java:1155
data.getFloat("colorThreshold", 0.5f));
case "SunMesh" -> {
var cvals = data.get("colors").asStringArray();
var colors = new Color[cvals.length];
for(int i=0; i<cvals.length; i++){
colors[i] = Color.valueOf(cvals[i]);
}
yield new SunMesh(planet, data.getInt("divisions", 1), data.getInt("octaves", 1), data.getFloat("persistence", 0.5f),
data.getFloat("scl", 1f), data.getFloat("pow", 1f), data.getFloat("mag", 0.5f),
data.getFloat("colorScale", 1f), colors);
}
case "HexSkyMesh" -> new HexSkyMesh(planet,
data.getInt("seed", 0), data.getFloat("speed", 0), data.getFloat("radius", 1f),
data.getInt("divisions", 3), Color.valueOf(data.getString("color", "ffffff")), data.getInt("octaves", 1),
data.getFloat("persistence", 0.5f), data.getFloat("scale", 1f), data.getFloat("thresh", 0.5f));
case "MultiMesh" -> new MultiMesh(parseMeshes(planet, data.get("meshes")));
case "MatMesh" -> new MatMesh(parseMesh(planet, data.get("mesh")), parser.readValue(Mat3D.class, data.get("mat")));
default -> throw new RuntimeException("Unknown mesh type: " + tname);
};
}
private PartProgress parseProgressOp(PartProgress base, String op, JsonValue data){
//I have to hard-code this, no easy way of getting parameter names, unfortunately
return switch(op){
case "inv" -> base.inv();
case "slope" -> base.slope();
case "clamp" -> base.clamp();
case "delay" -> base.delay(data.getFloat("amount"));
case "sustain" -> base.sustain(data.getFloat("offset", 0f), data.getFloat("grow", 0f), data.getFloat("sustain"));
case "shorten" -> base.shorten(data.getFloat("amount"));
case "compress" -> base.compress(data.getFloat("start"), data.getFloat("end"));
case "add" -> data.has("amount") ? base.add(data.getFloat("amount")) : base.add(parser.readValue(PartProgress.class, data.get("other")));
case "blend" -> base.blend(parser.readValue(PartProgress.class, data.get("other")), data.getFloat("amount"));
case "mul" -> data.has("amount") ? base.mul(data.getFloat("amount")) : base.mul(parser.readValue(PartProgress.class, data.get("other")));
case "min" -> base.min(parser.readValue(PartProgress.class, data.get("other")));
case "sin" -> base.sin(data.has("offset") ? data.getFloat("offset") : 0f, data.getFloat("scl"), data.getFloat("mag"));View on GitHub (pinned to f695ad7e60)
Solutions
- Use a mesh type name that exists as a case in parseMesh() (SunMesh, HexSkyMesh, MultiMesh, MatMesh, and others listed in ContentParser.java around line 1100-1155).
- Check the spelling and capitalization exactly.
- For custom meshes, build them in code rather than JSON.
Example fix
// before
{ "type": "sun-mesh", "divisions": 2 }
// after
{ "type": "SunMesh", "divisions": 2 } Defensive patterns
Strategy: validation
Validate before calling
// Whitelist mesh type names before constructing mesh configs.
Set<String> meshTypes = Set.of("SunMesh","HexSkyMesh","MultiMesh","MatMesh" /* + others in parseMesh() */);
String mt = meshObject.getString("type", "");
if(!meshTypes.contains(mt)) throw new IllegalStateException("Unknown mesh type '" + mt + "'"); Prevention
- Cross-check mesh type names with parseMesh() cases.
- Build custom meshes in code.
When it happens
Trigger: A planet "mesh" (or "cloudMesh") object specifies "type": "<unknown>" where <unknown> is not one of the cases in parseMesh().
Common situations: Typo in the mesh type name; using a mesh class from a newer/older build; referencing a custom mesh not registered for JSON parsing.
Related errors
- Meshes must be objects.
- Planet '${value.getString("planet")}' not found.
- Unknown consumption type: '${child.name}' for block '${block
- Blocks cannot be larger than ${maxBlockSize}
- Unit '${name}' has an incorrect type. Types must be strings.
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/a00ee90135135eda.
Report an issue: GitHub.