Anuken/Mindustry · error · ArcRuntimeException

Objective marker too long

Error message

Objective marker too long

What it means

readObjectiveMarker() reads a JSON ObjectiveMarker. It reads a 4-byte length and throws ArcRuntimeException if length > maxByteArraySize (40_000). It bounds the marker payload.

Source

Thrown at core/src/mindustry/io/TypeIO.java:956

    }

    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);
    }

    public static void writeObjectiveMarker(Writes write, ObjectiveMarker marker){
        String string = JsonIO.json.toJson(marker, MapObjectives.ObjectiveMarker.class);
        byte[] bytes = string.getBytes(charset);
        write.i(bytes.length);
        write.b(bytes);
    }

    public static ObjectiveMarker readObjectiveMarker(Reads read){
        int length = read.i();
        if(length > maxByteArraySize) throw new ArcRuntimeException("Objective marker too long");
        String string = new String(read.b(new byte[length]), charset);
        return JsonIO.read(MapObjectives.ObjectiveMarker.class, string);
    }

    public static void writeVecNullable(Writes write, @Nullable Vec2 v){
        if(v == null){
            write.f(Float.NaN);
            write.f(Float.NaN);
        }else{
            write.f(v.x);
            write.f(v.y);
        }
    }

    public static @Nullable Vec2 readVecNullable(Reads read){
        float x = read.f(), y = read.f();
        return Float.isNaN(x) || Float.isNaN(y) ? null : new Vec2(x, y);
    }

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Keep marker JSON under 40KB.
  2. Trim the marker payload; move large data elsewhere.
Defensive patterns

Strategy: validation

Validate before calling

// Before writing a marker, check serialized size against the read cap.
String json = JsonIO.json.toJson(marker, MapObjectives.ObjectiveMarker.class);
if(json.getBytes(java.nio.charset.StandardCharsets.UTF_8).length > 40_000){
    throw new IllegalStateException("Objective marker too large");
}

Try / catch

try { ObjectiveMarker m = TypeIO.readObjectiveMarker(read); }
catch(ArcRuntimeException e){ Log.err("Marker payload too large", e); /* handle */ }

Prevention

When it happens

Trigger: An objective-marker packet whose int length field exceeds 40_000.

Common situations: Oversized marker data; a mod embedding large blobs in a marker; corruption.

Related errors


AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14). Data as JSON: /api/errors/5c2ddf20ccbd858f. Report an issue: GitHub.