Anuken/Mindustry · error · IllegalArgumentException

Unknown plan config object type:

Error message

Unknown plan config object type: 

What it means

readClientPlanConfig() reads a single config-type byte and switches on it; valid types are 0 (null), 1 (int), 2 (long), 3 (float), 5 (Content), 10 (boolean), 11 (double). Any other byte hits the default IllegalArgumentException. The gaps (4,6,7,8,9) are intentionally invalid for client plans.

Source

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

            Object config = readClientPlanConfig(read);
            BuildPlan plan = new BuildPlan(x, y, rotation, block, config);
            result.add(plan);
        }

        return result;
    }

    static @Nullable Object readClientPlanConfig(Reads read){
        byte type = read.b();
        return switch(type){
            case 0 -> null;
            case 1 -> read.i();
            case 2 -> read.l();
            case 3 -> read.f();
            case 5 -> content.getByID(ContentType.all[read.b()], read.s());
            case 10 -> read.bool();
            case 11 -> read.d();
            default -> throw new IllegalArgumentException("Unknown plan config object type: " + type);
        };
    }

    //for client plans, most configs aren't necessary (links are intentionally not displayed/sent)
    static boolean validClientPlanConfig(Object o){
        return o == null || o instanceof Number || o instanceof Boolean || o instanceof Content;
    }

    public static void writeController(Writes write, UnitController control){
        //no real unit controller state is written, only the type
        if(control instanceof Player p){
            write.b(0);
            write.i(p.id);
        }else if(control instanceof LogicAI logic && logic.controller != null){
            write.b(3);
            write.i(logic.controller.pos());
        }else if(control instanceof CommandAI ai){
            write.b(9);

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Match client and server versions.
  2. Server: catch IllegalArgumentException and kick the sender.
  3. Only emit config types 0,1,2,3,5,10,11 from client-plan writers.
Defensive patterns

Strategy: try-catch

Try / catch

try { ClientBuildPlans p = TypeIO.readClientPlans(read); }
catch(IllegalArgumentException e){ Log.err("Unknown plan config type", e); con.kick("Protocol mismatch."); }

Prevention

When it happens

Trigger: A client-plan config type byte is outside the set {0,1,2,3,5,10,11}.

Common situations: Client/server version mismatch in the client-plan config format; packet corruption; fuzzing.

Related errors


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