Anuken/Mindustry · error · RuntimeException

PartProgress object need a 'type' string field. Check the Pa

Error message

PartProgress object need a 'type' string field. Check the PartProgress class for a list of constants.

What it means

Thrown by the PartProgress parser when the value is an object lacking a `type` field. A PartProgress object must declare which named progress constant it extends before optional operations are applied.

Source

Thrown at core/src/mindustry/mod/ContentParser.java:233

            data.remove("type");
            var result = make(bc);
            readFields(result, data);
            return result;
        });
        put(DrawPart.class, (type, data) -> {
            Class<?> bc = resolve(data.getString("type", ""), RegionPart.class);
            data.remove("type");
            var result = make(bc);
            readFields(result, data);
            return result;
        });
        put(PartProgress.class, (type, data) -> {
            //simple case: it's a string or number constant
            if(data.isString()) return field(PartProgress.class, data.asString());
            if(data.isNumber()) return PartProgress.constant(data.asFloat());

            if(!data.has("type")){
                throw new RuntimeException("PartProgress object need a 'type' string field. Check the PartProgress class for a list of constants.");
            }

            PartProgress base = (PartProgress)field(PartProgress.class, data.getString("type"));

            JsonValue opval =
                data.has("operation") ? data.get("operation") :
                data.has("op") ? data.get("op") : null;

            //no singular operation, check for multi-operation
            if(opval == null){
                JsonValue opsVal =
                    data.has("operations") ? data.get("operations") :
                    data.has("ops") ? data.get("ops") : null;

                if(opsVal != null){
                    if(!opsVal.isArray()) throw new RuntimeException("Chained PartProgress operations must be an array.");
                    int i = 0;
                    while(true){

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Add a `type` field referencing a constant on the PartProgress class (e.g. "heat", "reload").
  2. Alternatively use the string shorthand (named constant) or number shorthand (constant(float)).

Example fix

// before
{ "operations": [ { "op": "mul", "by": 2 } ] }
// after
{ "type": "heat", "operations": [ { "op": "mul", "by": 2 } ] }
Defensive patterns

Strategy: validation

Validate before calling

// Validate a PartProgress object has a 'type' before parsing.
boolean validProgressObject(JsonValue v) {
    return v.isString() || v.isNumber() || (v.isObject() && v.has("type"));
}

Prevention

When it happens

Trigger: A mod JSON defines a PartProgress as an object with operations/fields but omits the required `type` key.

Common situations: Authoring weapon part progress curves and forgetting the base type, or copying an operation-only snippet.

Related errors


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