{"record":{"id":"9f043d27c42dd5db","repo":"Anuken/Mindustry","slug":"unknown-team-data-asstring","errorCode":null,"errorMessage":"Unknown team: ${data.asString()}","messagePattern":"Unknown team: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"core/src/mindustry/mod/ContentParser.java","lineNumber":393,"sourceCode":"            var consume = make(oc);\n            readFields(consume, data);\n            return consume;\n        });\n        put(ConsumeLiquidBase.class, (type, data) -> {\n            var oc = resolve(data.getString(\"type\", \"\"), ConsumeLiquidBase.class);\n            data.remove(\"type\");\n            var consume = make(oc);\n            readFields(consume, data);\n            return consume;\n        });\n        put(Team.class, (type, data) -> {\n            if(data.isString()){\n                Team out = Structs.find(Team.baseTeams, t -> t.name.equals(data.asString()));\n                if(out == null) throw new IllegalArgumentException(\"Unknown team: \" + data.asString());\n                return out;\n            }else if(data.isNumber()){\n                if(data.asInt() >= Team.all.length || data.asInt() < 0){\n                    throw new IllegalArgumentException(\"Unknown team: \" + data.asString());\n                }\n                return Team.get(data.asInt());\n            }else{\n                throw new IllegalArgumentException(\"Unknown team: \" + data.asString() + \". Team must either be a string or a number.\");\n            }\n        });\n    }};\n    /** Stores things that need to be parsed fully, e.g. reading fields of content.\n     * This is done to accommodate binding of content names first.*/\n    private Seq<Runnable> reads = new Seq<>();\n    private Seq<Runnable> postreads = new Seq<>();\n    private ObjectSet<Object> toBeParsed = new ObjectSet<>();\n\n    @Nullable LoadedMod currentMod;\n    @Nullable Content currentContent;\n    @Nullable Fi currentFile;\n\n    private Json parser = new Json(){","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/Anuken/Mindustry/blob/f695ad7e60323ebced984fa26d0bcf0bc54296b4/core/src/mindustry/mod/ContentParser.java#L375-L411","documentation":"Thrown by the Team parser when data is a number whose value is >= Team.all.length. Numeric team IDs must index into the allocated team array; an ID past the end is invalid.","triggerScenarios":"A mod JSON team field is a number larger than or equal to the size of Team.all (too many teams allocated / version with fewer teams).","commonSituations":"Hard-coding a high team ID that exceeds the current game's team allocation, or assuming a team count from a different version/mod.","solutions":["Use a team index within [0, Team.all.length).","Prefer a base team name string for built-in teams.","If a custom high ID is required, ensure enough teams are allocated first (mod/server config)."],"exampleFix":"// before\n\"team\": 999\n// after\n\"team\": 1   // or \"team\": \"crux\"","handlingStrategy":"validation","validationCode":"// Verify a numeric team ID is within the allocated range.\nboolean validTeamId(int id) {\n    return id >= 0 && id < Team.all.length;\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep team IDs within [0, Team.all.length).","Prefer base team name strings for built-in teams.","Allocate enough teams before referencing high IDs."],"tags":["modding","json","content-parser","team"],"backgroundTag":null,"analyzedSha":"f695ad7e60323ebced984fa26d0bcf0bc54296b4","analyzedAt":"2026-08-14T04:31:16.262Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}