Anuken/Mindustry · error · RuntimeException

'${field.field.getName()}' in ${className} is missing! ${obj

Error message

'${field.field.getName()}' in ${className} is missing! ${object}.${field.field.getName()} cannot be null.

What it means

After ContentParser reads mod JSON into a content object it walks every reflective field and rejects any that is null, not annotated @Nullable, not in the implicitNullable allow-list, and not primitive. This enforces that a mod's JSON fully populates the required fields of the target content class (Block, Item, Liquid, etc.). The message names the exact missing field and class.

Source

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

        }
    }
    Object fieldOpt(Class<?> type, JsonValue value){
        try{
            return type.getField(value.asString()).get(null);
        }catch(Exception e){
            return null;
        }
    }

    void checkNullFields(Object object){
        if(object == null || object instanceof Number || object instanceof String || toBeParsed.contains(object) || object.getClass().getName().startsWith("arc.")) return;

        parser.getFields(object.getClass()).values().toSeq().each(field -> {
            try{
                if(field.field.getType().isPrimitive()) return;

                if(!field.field.isAnnotationPresent(Nullable.class) && field.field.get(object) == null && !implicitNullable.contains(field.field.getType())){
                    throw new RuntimeException("'" + field.field.getName() + "' in " +
                        ((object.getClass().isAnonymousClass() ? object.getClass().getSuperclass() : object.getClass()).getSimpleName()) +
                        " is missing! " + object + "." + field.field.getName() + " cannot be null.");
                }
            }catch(Exception e){
                throw new RuntimeException(e);
            }
        });
    }

    private void readFields(Object object, JsonValue jsonMap, boolean stripType){
        if(stripType) jsonMap.remove("type");
        readFields(object, jsonMap);
    }

    void readFields(Object object, JsonValue jsonMap){
        if(!jsonMap.isObject()) throw new SerializationException("Expecting an object, but found: '" + jsonMap + "'");
        JsonValue research = jsonMap.remove("research");

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Read the message: it states 'FIELD in CLASS is missing'. Add that exact field to your JSON entry.
  2. Confirm the field name spelling and that it is not a removed/renamed field in your game version.
  3. If the field is genuinely optional for your content, the fix belongs in source (annotate the field @Nullable) — not in user JSON.
  4. Re-test by loading only your mod to isolate the entry causing the failure.

Example fix

// before (mod json, incomplete)
{
  "type": "Item",
  "name": "my-item",
  "color": "ff0000"
}
// error: 'hardness in Item is missing! ...'

// after
{
  "type": "Item",
  "name": "my-item",
  "color": "ff0000",
  "hardness": 0
}
Defensive patterns

Strategy: validation

Validate before calling

// Before relying on a parsed content object, ensure required fields are populated.
for(Field f : obj.getClass().getDeclaredFields()){
    f.setAccessible(true);
    if(!f.getType().isPrimitive()
       && !f.isAnnotationPresent(Nullable.class)
       && f.get(obj) == null){
        throw new IllegalStateException("Required field null: " + f.getName());
    }
}

Try / catch

try {
    parser.parse(...);
} catch(RuntimeException e) {
    if(e.getMessage() != null && e.getMessage().contains("is missing!")) {
        // surface field name to user for correction
    } else throw e;
}

Prevention

When it happens

Trigger: A mod content JSON entry omits a required field that has no default and no @Nullable annotation. Triggered during the content-parsing pass that follows field reading, via checkNullFields(object) called on the parsed instance.

Common situations: Mod author forgets a mandatory field; mod targets an older game version whose schema changed (a field became required); typo in a field name so it is silently ignored and left null; referencing a content type whose Java default is null.

Related errors


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