Anuken/Mindustry · error · RuntimeException
SectorPresets must have a sector number.
Error message
SectorPresets must have a sector number.
What it means
When creating a new SectorPreset (not patching an existing one), the JSON must contain a numeric "sector" field identifying which sector slot on the planet the preset occupies. Missing the key or supplying a non-number aborts preset creation before the Planet is even looked up.
Source
Thrown at core/src/mindustry/mod/ContentParser.java:756
});
}
});
return status;
},
ContentType.sector, (TypeParser<SectorPreset>)(mod, name, value) -> {
readBundle(ContentType.sector, name, value);
if(value.isString()){
return locate(ContentType.sector, name);
}
SectorPreset preset;
SectorPreset found = allowPatching ? locate(ContentType.sector, name) : null;
if(found != null){
preset = found;
}else{
if(!value.has("sector") || !value.get("sector").isNumber()) throw new RuntimeException("SectorPresets must have a sector number.");
preset = new SectorPreset(mod + "-" + name, currentMod);
}
currentContent = preset;
read(() -> {
Planet planet = preset.planet == null ? Planets.serpulo : preset.planet;
if(value.has("planet")){
planet = locate(ContentType.planet, value.getString("planet", "serpulo"));
if(planet == null) throw new RuntimeException("Planet '" + value.getString("planet") + "' not found.");
}
if(value.has("sector")){
//clear old value
Sector prev = preset.sector;
if(prev != null && prev.preset == preset){
prev.preset = null;View on GitHub (pinned to f695ad7e60)
Solutions
- Add a numeric "sector" field, e.g. "sector": 5.
- Ensure the value is an integer within the planet's sector count (it is taken modulo planet.sectors.size later, but must be a number here).
- If patching an existing preset, confirm allowPatching is on and the preset already exists (then the branch is skipped).
Example fix
// before "sector": "five" // after "sector": 5
Defensive patterns
Strategy: validation
Validate before calling
if(!value.has("sector") || !value.get("sector").isNumber()){
throw new IllegalStateException("SectorPreset must include a numeric 'sector' field");
} Prevention
- Always include an integer "sector" in new preset JSON.
- For patches, ensure allowPatching and an existing preset.
When it happens
Trigger: A sector preset JSON omits "sector", or sets it to a string/boolean. The guard is !value.has("sector") || !value.get("sector").isNumber().
Common situations: Forgetting the sector index; copy-pasting a preset and not updating the number; confusing "sector" with the preset's own name.
Related errors
- Planet '${value.getString("planet")}' not found.
- Overwriting existing sectors is not allowed.
- Rules must be an object!
- Unknown consumption type: '${child.name}' for block '${block
- Blocks cannot be larger than ${maxBlockSize}
AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14).
Data as JSON: /api/errors/248c483143e43349.
Report an issue: GitHub.