Anuken/Mindustry · error · ArcRuntimeException
Rules too long
Error message
Rules too long
What it means
readRules() reads JSON-serialized Rules from a Reads stream. It reads a 4-byte length and throws ArcRuntimeException if it exceeds 100_000 bytes. The cap protects the client (rules arrive on connect) from a hostile or buggy server's oversized payload.
Source
Thrown at core/src/mindustry/io/TypeIO.java:928
public static void writeMarkerControl(Writes write, LMarkerControl reason){
write.b((byte)reason.ordinal());
}
public static LMarkerControl readMarkerControl(Reads read){
return LMarkerControl.all[read.ub()];
}
public static void writeRules(Writes write, Rules rules){
String string = JsonIO.write(rules);
byte[] bytes = string.getBytes(charset);
write.i(bytes.length);
write.b(bytes);
}
public static Rules readRules(Reads read){
int length = read.i();
//this is only called clientside, but the byte limit is reasonable either way...
if(length > 100_000) throw new ArcRuntimeException("Rules too long");
String string = new String(read.b(new byte[length]), charset);
return JsonIO.read(Rules.class, string);
}
public static void writeObjectives(Writes write, MapObjectives executor){
String string = JsonIO.write(executor);
byte[] bytes = string.getBytes(charset);
write.i(bytes.length);
write.b(bytes);
}
public static MapObjectives readObjectives(Reads read){
int length = read.i();
if(length >= 60_000) throw new RuntimeException("Objectives bytes too long: " + length);
String string = new String(read.b(new byte[length]), charset);
return JsonIO.read(MapObjectives.class, string);
}
View on GitHub (pinned to f695ad7e60)
Solutions
- Reduce rules complexity/mods so serialized Rules stays under 100KB.
- If you are the client hitting this on a server you do not control, the server is hostile or buggy — leave the server.
Defensive patterns
Strategy: validation
Validate before calling
// Before writing rules, check serialized size against the read cap.
String json = JsonIO.write(rules);
if(json.getBytes(java.nio.charset.StandardCharsets.UTF_8).length > 100_000){
throw new IllegalStateException("Rules JSON too large");
} Try / catch
try { Rules r = TypeIO.readRules(read); }
catch(ArcRuntimeException e){ Log.err("Rules payload too large", e); /* disconnect from server */ } Prevention
- Audit rules fields a mod adds; keep serialized size under 100KB.
- Treat an oversized rules payload from an unknown server as hostile.
When it happens
Trigger: A rules packet whose int length field exceeds 100_000.
Common situations: A heavily customized gamemode or mod that inflates Rules JSON; a malicious server; corruption.
Related errors
- Invalid array size: {}
- Invalid array size:
- Queue too long:
- Too many plans:
- Objectives bytes too long:
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/6c3d2902978b23a3.
Report an issue: GitHub.