{"record":{"id":"80374f7972b90d6e","repo":"egametang/ET","slug":"invalid-number-of-verts-per-poly-header-maxvertsp","errorCode":null,"errorMessage":"Invalid number of verts per poly {header.maxVertsPerPoly}","messagePattern":"Invalid number of verts per poly (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"Packages/cn.etetet.recast/Scripts/Core/Share/Detour/Io/DtMeshSetReader.cs","lineNumber":65,"sourceCode":"            return Read(bb, maxVertPerPoly, true);\n        }\n\n        public DtNavMesh Read(BinaryReader @is)\n        {\n            return Read(IOUtils.ToByteBuffer(@is));\n        }\n\n        public DtNavMesh Read(RcByteBuffer bb)\n        {\n            return Read(bb, -1, false);\n        }\n\n        DtNavMesh Read(RcByteBuffer bb, int maxVertPerPoly, bool is32Bit)\n        {\n            NavMeshSetHeader header = ReadHeader(bb, maxVertPerPoly);\n            if (header.maxVertsPerPoly <= 0)\n            {\n                throw new IOException(\"Invalid number of verts per poly \" + header.maxVertsPerPoly);\n            }\n\n            bool cCompatibility = header.version == NavMeshSetHeader.NAVMESHSET_VERSION;\n            DtNavMesh mesh = new DtNavMesh(header.option, header.maxVertsPerPoly);\n            ReadTiles(bb, is32Bit, header, cCompatibility, mesh);\n            return mesh;\n        }\n\n        private NavMeshSetHeader ReadHeader(RcByteBuffer bb, int maxVertsPerPoly)\n        {\n            NavMeshSetHeader header = new NavMeshSetHeader();\n            header.magic = bb.GetInt();\n            if (header.magic != NavMeshSetHeader.NAVMESHSET_MAGIC)\n            {\n                header.magic = IOUtils.SwapEndianness(header.magic);\n                if (header.magic != NavMeshSetHeader.NAVMESHSET_MAGIC)\n                {\n                    throw new IOException(\"Invalid magic \" + header.magic);","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/egametang/ET/blob/5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f/Packages/cn.etetet.recast/Scripts/Core/Share/Detour/Io/DtMeshSetReader.cs#L47-L83","documentation":"Thrown by DtMeshSetReader.Read when the parsed set header has maxVertsPerPoly <= 0. This value (nvp) defines the max polygon size for the navmesh; a non-positive value is invalid. It usually means the caller passed -1 (the default) but the set file did not embed the field (only NAVMESHSET_VERSION_RECAST4J embeds it).","triggerScenarios":"Calling Read(bb) with the no-nvp overload on a set file whose version is not NAVMESHSET_VERSION_RECAST4J, so maxVertsPerPoly stays at the default -1; passing maxVertPerPoly <= 0 explicitly.","commonSituations":"Loading a standard (non-recast4j) navmesh set through the convenience overload that does not supply nvp; misconfiguration of the loader pipeline.","solutions":["Call Read(bb, maxVertPerPoly, is32Bit) with a valid nvp (typically 6, matching DT_VERTS_PER_POLYGON) when the file does not embed it.","Ensure exported set files use a version that embeds maxVertsPerPoly, or always supply it at load time.","Validate the value is > 0 before constructing the DtNavMesh."],"exampleFix":"// before\nvar mesh = setReader.Read(bb); // default nvp = -1 -> throws\n\n// after\nconst int NVP = 6;\nvar mesh = setReader.Read(bb, NVP, false);","handlingStrategy":"validation","validationCode":"int nvp = ResolveNvp(); // from config or known good default\nif (nvp <= 0) nvp = 6; // DT_VERTS_PER_POLYGON\nvar mesh = setReader.Read(bb, nvp, false);","typeGuard":"static bool IsValidNvp(int nvp) => nvp > 0;","tryCatchPattern":"try { var mesh = setReader.Read(bb, nvp, is32Bit); }\ncatch (IOException e) when (e.Message.Contains(\"verts per poly\"))\n{ /* supply explicit nvp and retry */ }","preventionTips":["Always pass an explicit positive nvp (typically 6) when loading non-recast4J set files.","Export set files in a version that embeds maxVertsPerPoly if you rely on the convenience overload.","Validate nvp > 0 before constructing the DtNavMesh."],"tags":["detour","io","navmesh","config","file-format"],"backgroundTag":null,"analyzedSha":"5cab01f7a8bee5f49f4781eebe9e2b1c6d7ebe0f","analyzedAt":"2026-08-13T21:10:40.377Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}