Anuken/Mindustry · error · RuntimeException
Queue too long:
Error message
Queue too long:
What it means
readPlansQueueNet() reads a network-synced build-plan queue. After reading an int count it throws if count > maxSyncedPlans (20). This caps how many BuildPlans a single sync packet can carry to bound processing and bandwidth. Note the save-path readPlansQueue (TypeIO.java:602) deliberately has no cap.
Source
Thrown at core/src/mindustry/io/TypeIO.java:594
//on the network, plans must be capped by size
public static void writePlansQueueNet(Writes write, Queue<BuildPlan> plans){
if(plans == null){
write.i(-1);
return;
}
int used = getMaxPlans(plans);
write.i(used);
for(int i = 0; i < used; i++){
writePlan(write, plans.get(i));
}
}
public static Queue<BuildPlan> readPlansQueueNet(Reads read){
int used = read.i();
if(used == -1) return null;
if(used > maxSyncedPlans) throw new RuntimeException("Queue too long: " + used);
var out = new Queue<BuildPlan>();
for(int i = 0; i < used; i++){
out.add(readPlan(read));
}
return out;
}
public static Queue<BuildPlan> readPlansQueue(Reads read){
int used = read.i();
if(used == -1) return null;
//this is ONLY used in saves, so don't enforce a max size, it can be anything.
var out = new Queue<BuildPlan>();
for(int i = 0; i < used; i++){
out.add(readPlan(read));
}
return out;
}
View on GitHub (pinned to f695ad7e60)
Solutions
- Limit the number of plans queued/sent per network sync to <= 20.
- Server: catch the RuntimeException and kick the sender.
Example fix
// before queue.addAll(manyPlans); // > 20 in one sync TypeIO.writePlansQueueNet(write, queue); // after Queue<BuildPlan> capped = new Queue<>(); for(int i = 0; i < Math.min(maxSyncedPlans, manyPlans.size); i++) capped.add(manyPlans.get(i)); TypeIO.writePlansQueueNet(write, capped);
Defensive patterns
Strategy: validation
Validate before calling
// Before syncing, ensure the queue fits the network cap.
if(plans.size > 20){
throw new IllegalStateException("Too many plans to sync: " + plans.size);
} Try / catch
try { Queue<BuildPlan> q = TypeIO.readPlansQueueNet(read); }
catch(RuntimeException e){ Log.err("Build-plan sync too long", e); con.kick("Invalid packet."); } Prevention
- Batch build-plan syncs in chunks of <= 20.
- Use readPlansQueue only for saves; it has no cap and is not net-safe.
When it happens
Trigger: A build-plan sync packet's int count field exceeds 20.
Common situations: A client queueing more than 20 plans in one sync; a buggy mod; a malicious client.
Related errors
- Too many plans:
- Invalid array size: {}
- Invalid array size:
- Unknown plan config object type:
- Rules too long
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/6da2fb97cf799782.
Report an issue: GitHub.