{"record":{"id":"e66d9c443638dabb","repo":"Anuken/Mindustry","slug":"planet-value-getstring-planet-not-found","errorCode":null,"errorMessage":"Planet '${value.getString(\"planet\")}' not found.","messagePattern":"Planet '(.+?)' not found\\.","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/mod/ContentParser.java","lineNumber":767,"sourceCode":"\n            SectorPreset preset;\n            SectorPreset found = allowPatching ? locate(ContentType.sector, name) : null;\n\n            if(found != null){\n                preset = found;\n            }else{\n                if(!value.has(\"sector\") || !value.get(\"sector\").isNumber()) throw new RuntimeException(\"SectorPresets must have a sector number.\");\n\n                preset = new SectorPreset(mod + \"-\" + name, currentMod);\n            }\n\n            currentContent = preset;\n            read(() -> {\n                Planet planet = preset.planet == null ? Planets.serpulo : preset.planet;\n                if(value.has(\"planet\")){\n                    planet = locate(ContentType.planet, value.getString(\"planet\", \"serpulo\"));\n\n                    if(planet == null) throw new RuntimeException(\"Planet '\" + value.getString(\"planet\") + \"' not found.\");\n                }\n\n                if(value.has(\"sector\")){\n                    //clear old value\n                    Sector prev = preset.sector;\n                    if(prev != null && prev.preset == preset){\n                        prev.preset = null;\n                    }\n                    int sector = value.getInt(\"sector\", 0) % planet.sectors.size;\n                    if(!allowPatching && sector > 0 && planet.sectors.get(sector).preset != null){\n                        throw new RuntimeException(\"Overwriting existing sectors is not allowed.\");\n                    }\n                    preset.initialize(planet, sector, true);\n                }\n\n                value.remove(\"sector\");\n                value.remove(\"planet\");\n","sourceCodeStart":749,"sourceCodeEnd":785,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/mod/ContentParser.java#L749-L785","documentation":"When a sector preset JSON specifies a \"planet\", the parser calls locate(ContentType.planet, ...) to find it. If no registered Planet matches the name (including the current-mod-prefixed lookup), locate returns null and the parser throws, because a preset cannot exist without a host planet.","triggerScenarios":"A preset sets \"planet\": \"nonexistent\" or misspells a planet name (e.g. \"serpulo\" vs \"serpullo\"). The planet must already be registered in content before the preset is parsed.","commonSituations":"Referencing a custom planet that loads in a later content pass; typo; depending on a planet from an unloaded mod.","solutions":["Use the correct internal planet name (default is \"serpulo\").","Ensure the planet's content JSON is loaded before this preset (mod load order).","Register the planet in the same mod with proper ordering."],"exampleFix":"// before\n\"planet\": \"serpullo\"\n// after\n\"planet\": \"serpulo\"","handlingStrategy":"validation","validationCode":"if(value.has(\"planet\")){\n    String pname = value.getString(\"planet\", \"serpulo\");\n    if(Vars.content.planets().find(p -> p.name.equals(pname)) == null){\n        throw new IllegalStateException(\"Planet '\" + pname + \"' is not registered\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use registered planet names only (serpulo by default).","Ensure custom planets load before presets referencing them."],"tags":["mindustry","modding","json","content-parser","sector-preset","planet","missing-reference"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}