Anuken/Mindustry · error · IOException

Map name cannot be empty! File:

Error message

Map name cannot be empty! File: 

What it means

Thrown by Maps.loadMap(Fi, boolean) after MapIO.createMap builds a Map from a file. If the resulting Map has a null name (no name metadata in the .msav), it is rejected with an IOException. Maps are expected to always carry a non-null name so they can be listed and referenced.

Source

Thrown at core/src/mindustry/maps/Maps.java:483

        String name = Strings.sanitizeFilename(unsanitizedName);
        if(name.isEmpty()) name = "blank";

        Fi result = null;
        int index = 0;

        while(result == null || result.exists()){
            result = customMapDirectory.child(name + (index == 0 ? "" : "_" + index) + "." + mapExtension);
            index ++;
        }

        return result;
    }

    private Map loadMap(Fi file, boolean custom) throws IOException{
        Map map = MapIO.createMap(file, custom);

        if(map.name() == null){
            throw new IOException("Map name cannot be empty! File: " + file);
        }

        maps.add(map);
        maps.sort();
        return map;
    }

    public interface MapProvider{
        @Nullable Map next(Gamemode mode, @Nullable Map previous);
    }

    public enum ShuffleMode implements MapProvider{
        none((mode, map) -> null),
        all((mode, prev) -> next(mode, prev, Vars.maps.defaultMaps(), Vars.maps.customMaps())),
        custom((mode, prev) -> next(mode, prev, Vars.maps.customMaps().isEmpty() ? Vars.maps.defaultMaps() : Vars.maps.customMaps())),
        builtin((mode, prev) -> next(mode, prev, Vars.maps.defaultMaps()));

        private final MapProvider provider;

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Remove or move the offending .msav out of the custom maps directory and re-export it from the editor with a real name.
  2. Re-save the map in the editor ensuring the name field is non-empty before exporting.
  3. Validate the file is a genuine Mindustry map and not truncated/corrupt.

Example fix

// before: map file 'blank.msav' has empty name metadata -> loadMap throws
// after: open in editor, set name 'My Map', re-export; loadMap succeeds
Defensive patterns

Strategy: try-catch

Try / catch

try {
    Map m = maps.loadMap(file, true);
} catch (IOException e) {
    // name was null/empty or file unreadable; skip this file and log it
    Log.err("Skipping invalid map file @: @", file, e.getMessage());
}

Prevention

When it happens

Trigger: Calling Maps.loadMap on a custom .msav file whose internal name field is null/empty; triggered during map import, shuffle-list rebuild, or server map scanning of customMapDirectory.

Common situations: Corrupted or partially-written .msav files, maps saved by an incompatible/older Mindustry version, hand-edited map files, or a map whose name was blanked in the editor before export.

Related errors


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