Anuken/Mindustry · error · ArcRuntimeException

UI result entry count exceeds max entries:

Error message

UI result entry count exceeds max entries: 

What it means

readMenuResult() reads a custom UI menu's returned values. It reads an unsigned short entry count and throws ArcRuntimeException if it exceeds MenuResult.maxTotalValues (500). The cap prevents a menu result from flooding the receiver with value entries.

Source

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

        }
    }

    public static MenuResult readMenuResult(Reads read){
        MenuResult result = new MenuResult();

        result.token = read.l();

        //would be nice to count bytes but sadly that's not really viable here
        int remainingChars = MenuResult.maxTotalStringLen;

        byte exists = read.b();
        if(exists != 0){
            result.result = read.str(MenuResult.maxResultLen);
            remainingChars -= result.result.length();
        } //else, no result, remains null

        int entries = read.us();
        if(entries > MenuResult.maxTotalValues) throw new ArcRuntimeException("UI result entry count exceeds max entries: " + entries);

        for(int i = 0; i < entries; i++){
            if(remainingChars <= 0) throw new ArcRuntimeException("Too many long strings in MenuResult, reduce your amount of elements/IDs.");
            String key = read.str(Math.min(remainingChars, MenuResult.maxValueLen));
            remainingChars -= key.length();

            byte type = read.b();

            switch(type){
                case 0 -> result.values.put(key, read.f());
                case 1 ->  result.values.put(key, read.bool());
                case 2 -> {
                    if(remainingChars <= 0) throw new ArcRuntimeException("Too many long strings in MenuResult, reduce your amount of elements/IDs.");
                    String value = read.str(Math.min(remainingChars, MenuResult.maxValueLen));
                    remainingChars -= value.length();
                    result.values.put(key, value);
                }
                default -> throw new ArcRuntimeException("Unknown UI entry type: " + type);

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Reduce the number of values your UI menu returns to <= 500.
  2. Audit the menu builder design; split the menu across multiple menus if needed.
Defensive patterns

Strategy: validation

Validate before calling

// Before returning a menu result, ensure the value count fits the cap.
if(menuResult.values.size() > MenuResult.maxTotalValues){
    throw new IllegalStateException("Menu returns too many values: " + menuResult.values.size());
}

Try / catch

try { MenuResult r = TypeIO.readMenuResult(read); }
catch(ArcRuntimeException e){ Log.err("Bad menu result", e); con.kick("Invalid menu result."); }

Prevention

When it happens

Trigger: A menu-result packet (from a logic/UI-builder menu) reports more than 500 value entries.

Common situations: A custom UI menu returning too many values; a mod that builds large menus; a malicious client.

Related errors


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