{"record":{"id":"a6f5b2b3386082d5","repo":"Anuken/Mindustry","slug":"all-maps-must-have-a-core","errorCode":null,"errorMessage":"All maps must have a core.","messagePattern":"All maps must have a core\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/maps/generators/FileMapGenerator.java","lineNumber":145,"sourceCode":"                }else if(tile.build instanceof CoreBuild && tile.team() == state.rules.defaultTeam && tile.build.pos() != params.corePositionOverride){\n                    //other cores placed must be cleared; they have been overridden\n                    tile.remove();\n                }\n            }else if(tile.isCenter() && tile.block() instanceof CoreBlock && tile.team() == state.rules.defaultTeam && !anyCores){\n                if(sector != null && sector.allowLaunchLoadout()){\n                    Schematics.placeLaunchLoadout(tile.x, tile.y);\n                }\n                anyCores = true;\n\n                if(preset.addStartingItems || !preset.planet.allowLaunchLoadout){\n                    tile.build.items.clear();\n                    tile.build.items.add(state.rules.loadout);\n                }\n            }\n        }\n\n        if(!anyCores){\n            throw new IllegalArgumentException(\"All maps must have a core.\");\n        }\n\n        state.map = map;\n    }\n}\n","sourceCodeStart":127,"sourceCodeEnd":151,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/maps/generators/FileMapGenerator.java#L127-L151","documentation":"Thrown by FileMapGenerator.generate after iterating spawn/core tiles. anyCores stays false when no core block was placed, so the map is rejected because every playable map requires at least one core tile to anchor the player and launch loadout.","triggerScenarios":"Generating a map from a preset/.msav whose tile data contains no core block; campaign sector maps or custom maps missing a core, especially for modes that need one.","commonSituations":"Custom map exported without placing a core block; a campaign map edited to remove its core; using a core-less map in attack/pvp/normal modes.","solutions":["Open the map in the editor and place at least one core block, then re-export.","Confirm the map is intended for a game mode that requires cores; otherwise switch mode.","If authoring a generator, ensure Schematics.placeLaunchLoadout targets a valid tile with a core."],"exampleFix":"// before: map has zero core tiles -> generate throws 'All maps must have a core.'\n// after: editor -> place Core:Sharded tile -> save -> generate succeeds","handlingStrategy":"validation","validationCode":"// Before generating, confirm the map/preset has at least one core tile.\nboolean hasCore = false;\nfor (int i = 0; i < tiles.width * tiles.height; i++) {\n    if (tiles.geti(i) == Blocks.coreSharded.id) { hasCore = true; break; }\n}\nif (!hasCore) throw new IllegalStateException(\"Map missing a core block\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always place a core block when authoring maps meant for core-requiring modes.","Validate map tile data for a core before calling the generator.","Pair maps with the correct Gamemode in shuffle configurations."],"tags":["maps","generation","core","filemapgenerator"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}